java.l
上传用户:afrynkmhm
上传日期:2007-01-06
资源大小:1262k
文件大小:4k
源码类别:

编译器/解释器

开发平台:

Others

  1. %{
  2. #include "JavaTokenTypes.hpp"
  3. extern void newLine();
  4. %}
  5. HexDigit [0-9a-fA-F]
  6. Digit [0-9]
  7. OctalDigit [0-7]
  8. NonZeroDigit [1-9]
  9. AnyButSlash [^/]
  10. AnyButAstr [^*]
  11. Unicode [\][u]{HexDigit}{HexDigit}{HexDigit}{HexDigit}
  12. Octal [\]{OctalDigit}({Digit}({Digit})?)?
  13. Escape [\]([r]|[n]|[b]|[f]|[t]|[\]|[']|["])|{Unicode}|{Octal}
  14. IntSuffix ([l]|[L])
  15. DecimalNum {NonZeroDigit}{Digit}*{IntSuffix}?
  16. OctalNum [0]{OctalDigit}*{IntSuffix}?
  17. HexNum [0]([x]|[X]){HexDigit}{HexDigit}*{IntSuffix}?
  18. IntegerLiteral ({DecimalNum}|{OctalNum}|{HexNum})
  19. Sign ([+]|[-])
  20. FlSuffix ([f]|[F]|[d][D])
  21. SignedInt {Sign}?{Digit}+
  22. Expo ([e]|[E])
  23. ExponentPart {Expo}{SignedInt}?
  24. Float1 {Digit}+[.]{Digit}+?{ExponentPart}?{FlSuffix}?
  25. Float2 [.]{Digit}+{ExponentPart}?{FlSuffix}?
  26. Float3 {Digit}+{ExponentPart}{FlSuffix}?
  27. Float4 {Digit}+{FlSuffix}
  28. FloatingPoint ({Float1}|{Float2}|{Float3}|{Float4})
  29. %%
  30. "?" return QUESTION;
  31. "(" return LPAREN;
  32. ")" return RPAREN;
  33. "[" return LBRACK;
  34. "]" return RBRACK;
  35. "{" return LCURLY;
  36. "}" return RCURLY;
  37. ":" return COLON;
  38. "," return COMMA;
  39. "." return DOT;
  40. "==" return EQUAL;
  41. "=" return ASSIGN;
  42. "!" return LNOT;
  43. "~" return BNOT;
  44. "!=" return NOT_EQUAL;
  45. "/=" return DIV_ASSIGN;
  46. "/" return DIV;
  47. "+=" return PLUS_ASSIGN;
  48. "++" return INC;
  49. "+" return PLUS;
  50. "-=" return MINUS_ASSIGN;
  51. "--" return DEC;
  52. "-" return MINUS;
  53. "*=" return STAR_ASSIGN;
  54. "*" return STAR;
  55. "%=" return MOD_ASSIGN;
  56. "%" return MOD;
  57. ">>>=" return BSR_ASSIGN;
  58. ">>>" return BSR;
  59. ">>=" return SR_ASSIGN;
  60. ">>" return SR;
  61. ">=" return GE;
  62. ">" return GT;
  63. "<<=" return SL_ASSIGN;
  64. "<<" return SL;
  65. "<=" return LE;
  66. "<" return LT_;
  67. "^=" return BXOR_ASSIGN;
  68. "^" return BXOR;
  69. "|=" return BOR_ASSIGN;
  70. "||" return LOR;
  71. "|" return BOR;
  72. "&=" return BAND_ASSIGN;
  73. "&&" return LAND;
  74. "&" return BAND;
  75. ";" return SEMI;
  76. [ ft] ;
  77. "rn"|r|n { newLine(); }
  78. "//".* ;
  79. "/*"({AnyButAstr}|"*"{AnyButSlash})*"*/" ;
  80. [']({Escape}|[^'])['] return CHAR_LITERAL;
  81. ["]({Escape}|[^"])*["] return STRING_LITERAL;
  82. while return LITERAL_while;
  83. volatile return LITERAL_volatile;
  84. void return LITERAL_void;
  85. try return LITERAL_try;
  86. true return LITERAL_true;
  87. transient return LITERAL_transient;
  88. throws return LITERAL_throws;
  89. throw return LITERAL_throw;
  90. threadsafe return LITERAL_threadsafe;
  91. this return LITERAL_this;
  92. synchronized return LITERAL_synchronized;
  93. switch return LITERAL_switch;
  94. super return LITERAL_super;
  95. static return LITERAL_static;
  96. short return LITERAL_short;
  97. return return LITERAL_return;
  98. public return LITERAL_public;
  99. protected return LITERAL_protected;
  100. private return LITERAL_private;
  101. package return LITERAL_package;
  102. null return LITERAL_null;
  103. new return LITERAL_new;
  104. native return LITERAL_native;
  105. long return LITERAL_long;
  106. interface return LITERAL_interface;
  107. int return LITERAL_int;
  108. instanceof return LITERAL_instanceof;
  109. import return LITERAL_import;
  110. implements return LITERAL_implements;
  111. if return LITERAL_if;
  112. for return LITERAL_for;
  113. float return LITERAL_float;
  114. finally return LITERAL_finally;
  115. final return LITERAL_final;
  116. false return LITERAL_false;
  117. extends return LITERAL_extends;
  118. else return LITERAL_else;
  119. double return LITERAL_double;
  120. do return LITERAL_do;
  121. default return LITERAL_default;
  122. continue return LITERAL_continue;
  123. class return LITERAL_class;
  124. char return LITERAL_char;
  125. catch return LITERAL_catch;
  126. case return LITERAL_case;
  127. byte return LITERAL_byte;
  128. break return LITERAL_break;
  129. boolean return LITERAL_boolean;
  130. abstract return LITERAL_abstract;
  131. [a-zA-Z_$][a-zA-Z_0-9$]* return IDENT;
  132. {IntegerLiteral} return NUM_INT;
  133. {FloatingPoint} return NUM_FLOAT;
  134. %%