##// END OF EJS Templates
Sync
Sync

File last commit:

r3:e85fcd939626 default
r5:c48b43d9c7fb default
Show More
lispLike.l
75 lines | 1.7 KiB | text/plain | TextLexer
%{
/* C++ string header, for string ops below */
#include <string>
#include <QString>
/* Implementation of yyFlexScanner */
#include "lispLike_scanner.h"
#include "lispLike.hpp"
/* typedef to make the returns for the tokens shorter */
typedef QIlib::lispLike_Parser::token token;
/* define to keep from re-typing the same code over and over */
#define STOKEN( x ) ( new QString( x ) )
/* define yyterminate as this instead of NULL */
//#define yyterminate() return( token::END )
/* msvc2010 requires that we exclude this header file. */
#define YY_NO_UNISTD_H
%}
%option debug
%option nodefault
%option yyclass="lispLike_Scanner"
%option noyywrap
%option c++
/* . { return yytext[0]; }*/
%%
[ \t\n]+ { }
\"[a-zA-Z0-9\-\/\(\)\. \:]+\" {
yylval->sval = STOKEN( yytext );
return( token::VALUE );
}
\([a-zA-Z0-9\_]+ {
yylval->sval = STOKEN( yytext );
return( token::NODE );
}
\) {
return( token::CLOSENODE );
}
[a-zA-Z0-9\-\/\.\_\~\?\*]+ {
yylval->sval = STOKEN( yytext );
return( token::VALUE );
}
\"\" {
yylval->sval = STOKEN( yytext );
return( token::VALUE );
}
.|\n {}
%%