2
0

wmllex.l 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. %{
  2. /*
  3. * @OSF_COPYRIGHT@
  4. * COPYRIGHT NOTICE
  5. * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
  6. * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
  7. * the full copyright text.
  8. */
  9. /*
  10. * HISTORY
  11. */
  12. #if defined(__STDC__)
  13. #include <string.h>
  14. #endif
  15. #ifndef XmConst
  16. #if (defined(__STDC__) && __STDC__) || !defined( NO_CONST )
  17. #define XmConst const
  18. #else
  19. #define XmConst
  20. #endif /* __STDC__ */
  21. #endif /* XmConst */
  22. #ifdef YY_BUFFER_SIZE
  23. #define BUF_SIZE YY_BUFFER_SIZE
  24. #else
  25. #define BUF_SIZE 8192
  26. #endif
  27. char yystringval[BUF_SIZE]; /* any string value */
  28. char yynameval[BUF_SIZE]; /* any identifier (name) */
  29. int yytknval1; /* terminal token value 1 */
  30. int yytknval2; /* terminal token value 2 */
  31. %}
  32. %p 3000
  33. %%
  34. [ \t\f] {}
  35. [\n] { wml_line_count += 1; }
  36. "Class" { return CLASS; }
  37. "Resource" { return RESOURCE; }
  38. "DataType" { return DATATYPE; }
  39. "ControlList" { return CONTROLLIST; }
  40. "EnumerationSet" { return ENUMERATIONSET; }
  41. "EnumerationValue" { return ENUMERATIONVALUE; }
  42. "CharacterSet" { return CHARACTERSET; }
  43. "Child" { return CHILD; }
  44. "DocName" { return DOCNAME; }
  45. "ConvenienceFunction" { return CONVFUNC; }
  46. "Alias" { return ALIAS; }
  47. "Type" { return TYPE; }
  48. "ResourceLiteral" { return RESOURCELITERAL; }
  49. "Related" { return RELATED; }
  50. "InternalLiteral" { return INTERNALLITERAL; }
  51. "Constraint" { return CONSTRAINT; }
  52. "Exclude" { return EXCLUDE;}
  53. "Resources" { return RESOURCES; }
  54. "SuperClass" { return SUPERCLASS; }
  55. "ParentClass" { return PARENTCLASS; }
  56. "Controls" { return CONTROLS; }
  57. "WidgetClass" { return WIDGETCLASS; }
  58. "DialogClass" { return DIALOGCLASS; }
  59. "Default" { return DEFAULT; }
  60. "EnumLiteral" { return ENUMLITERAL; }
  61. "XmStringCharsetName" { return XMSTRINGCHARSETNAME; }
  62. "FontListElementTag" { return XMSTRINGCHARSETNAME; }
  63. "Direction" { return DIRECTION; }
  64. "ParseDirection" { return PARSEDIRECTION; }
  65. "CharacterSize" { return CHARACTERSIZE; }
  66. "ControlsMapToResource" { return CTRLMAPSRESOURCE; }
  67. "Children" { return CHILDREN; }
  68. "MetaClass" { return METACLASS;}
  69. "Widget" { return WIDGET;}
  70. "Gadget" { return GADGET;}
  71. "Argument" { return ARGUMENT;}
  72. "Reason" { return REASON;}
  73. "Constraint" { return CONSTRAINT;}
  74. "SubResource" { return SUBRESOURCE;}
  75. "True" { return ATTRTRUE; }
  76. "False" { return ATTRFALSE; }
  77. "LeftToRight" { return LEFTTORIGHT; }
  78. "RightToLeft" { return RIGHTTOLEFT; }
  79. "OneByte" { return ONEBYTE; }
  80. "TwoByte" { return TWOBYTE; }
  81. "MixedOneAndTwoByte" { return MIXED1_2BYTE; }
  82. ":" { return COLON; }
  83. ";" { return SEMICOLON; }
  84. "=" { return EQUALS; }
  85. "{" { return LBRACE; }
  86. "}" { return RBRACE; }
  87. "!"[^\n]* {}
  88. "#"[^\n]* {}
  89. [a-zA-Z_][a-zA-Z0-9$_]* { /* string without quotes */
  90. strcpy (yystringval, (XmConst char *) yytext);
  91. return STRING;
  92. }
  93. \"[^"\n]*\\ { /* escaped character in the string */
  94. yymore();
  95. }
  96. \"[^"\n]*\" { /* String in quotes */
  97. strncpy(yystringval, (XmConst char *) yytext+1, yyleng - 2);
  98. yystringval[yyleng-2] = '\0' ;
  99. return STRING;
  100. }
  101. \"[^"\n]* {
  102. printf ("\nUnterminated string near %s, line %d",
  103. yytext, wml_line_count);
  104. return ERRORTOKEN;
  105. }
  106. . {
  107. printf ("\nEncountered illegal character '%c', line %d",
  108. yytext[0], wml_line_count);
  109. return ERRORTOKEN;
  110. }