Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package parsery.interpreter;
- import java_cup.runtime.*;
- %%
- %class MyLexer
- %line
- %column
- %cup
- %{
- private Symbol symbol(int type) {
- return new Symbol(type, yyline, yycolumn);
- }
- private Symbol symbol(int type, Object value) {
- return new Symbol(type, yyline, yycolumn, value);
- }
- %}
- LineTerminator = \r|\n|\r\n
- WhiteSpace = {LineTerminator} | [ \t\f]
- DATE = "date" | "DATE"
- %%
- /* ------------------------Lexical Rules Section---------------------- */
- <YYINITIAL> {
- {DATE} { return symbol(sym.DATE, new String(yytext())); }
- {WhiteSpace} { }
- }
- [^] { throw new Error("Nieoczekiwany znak <"+yytext()+">"); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement