diff options
Diffstat (limited to 'tksao/magnifier/lex.L')
-rw-r--r-- | tksao/magnifier/lex.L | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/tksao/magnifier/lex.L b/tksao/magnifier/lex.L new file mode 100644 index 0000000..05c586d --- /dev/null +++ b/tksao/magnifier/lex.L @@ -0,0 +1,65 @@ +/* Copyright (C) 1999-2016 + * Smithsonian Astrophysical Observatory, Cambridge, MA, USA + * For conditions of distribution and use, see copyright notice in "copyright" + */ + +%option noyywrap +%option caseless +%option never-interactive +%option c++ + +%{ + #include <stdio.h> + #include <stdlib.h> + #include <string.h> + + #include "parser.H" + + extern YYSTYPE* mglval; +%} + +D [0-9] +E [Ee][+-]?{D}+ + +/* rules */ + +%% + +bbox {return BBOX_;} +clear {return CLEAR_;} +debug {return DEBUG_;} +false {return FALSE_;} +get {return GET_;} +height {return HEIGHT_;} +hide {return HIDE_;} +off {return OFF_;} +on {return ON_;} +n {return N_;} +no {return NO_;} +reset {return RESET_;} +show {return SHOW_;} +true {return TRUE_;} +update {return UPDATE_;} +version {return VERSION_;} +width {return WIDTH_;} +y {return Y_;} +yes {return YES_;} + +[+-]?{D}+ { // Integer + mglval->integer = atoi(yytext); + return INT; + } + +0[xX][0-9a-fA-F]+ { // Pointer + mglval->ptr = (void*)strtoul(yytext,NULL,16); + return POINTER; + } + +[ \t]+ { // White Spaces + } + +. { // Else, return the char + return yytext[0]; + } + +%% |