From 19d2651ab7618afab39811907fd5b0ae0e36ad41 Mon Sep 17 00:00:00 2001 From: Kleidi Bujari Date: Fri, 4 Oct 2024 17:40:22 -0400 Subject: lab 1 --- F2024/cps710/assignments/A1/HL.jj | 83 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 F2024/cps710/assignments/A1/HL.jj (limited to 'F2024/cps710/assignments/A1/HL.jj') diff --git a/F2024/cps710/assignments/A1/HL.jj b/F2024/cps710/assignments/A1/HL.jj new file mode 100644 index 0000000..54657cc --- /dev/null +++ b/F2024/cps710/assignments/A1/HL.jj @@ -0,0 +1,83 @@ +options { + IGNORE_CASE=false; +} + +PARSER_BEGIN(HL) + + public class HL { } + +PARSER_END(HL) + + TOKEN_MGR_DECLS : +{ + static int depth; +} + +SKIP : +{ + " " + | "\t" + | "\n" + | "\r" + | <"//" (~["\n","\r"])* ("\n" | "\r" | "\r\n")> + | "/'" { depth = 1; SwitchTo(COMMENT_BLOCK); } +} + + SKIP: +{ + < "/'" > { depth++; } + | < "'/" > { if (--depth == 0) SwitchTo(DEFAULT); } + | < ~[] > +} + +TOKEN : +{ + + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | "> + | ="> + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +} + -- cgit 1.4.1