<requirement name="track-token-locations" stories="lexer">
#define YY_USER_ACTION \
do { \
yylloc->start = yyget_extra(yyscanner); \
yylloc->end = yylloc->start + yyleng; \
yyset_extra(yylloc->end, yyscanner); \
} while (0);
</requirement>
<requirement name="skip-comments" stories="lexer">
"#" { yy_push_state(IN_COMMENT, yyscanner); }
<IN_COMMENT>{
\\(\\|\r?\n)|. { }
\r?\n { yy_pop_state(yyscanner); }
}
<IN_COMMENT><<EOF>> { yy_pop_state(yyscanner); }
</requirement>
<requirement name="tokenize-keywords-and-operators" stories="lexer">
"!=" { return NEQ; }
"==" { return EQ; }
"as" { return AS; }
"import" { return IMPORT; }
"include" { return INCLUDE; }
"module" { return MODULE; }
"def" { return DEF; }
"if" { return IF; }
"then" { return THEN; }
"else" { return ELSE; }
"elif" { return ELSE_IF; }
"and" { return AND; }
"or" { return OR; }
"end" { return END; }
"reduce" { return REDUCE; }
"foreach" { return FOREACH; }
"//" { return DEFINEDOR; }
"try" { return TRY; }
"catch" { return CATCH; }
"label" { return LABEL; }
"break" { return BREAK; }
"$__loc__" { return LOC; }
"|=" { return SETPIPE; }
"+=" { return SETPLUS; }
"-=" { return SETMINUS; }
"*=" { return SETMULT; }
"/=" { return SETDIV; }
"%=" { return SETMOD; }
"//=" { return SETDEFINEDOR; }
"<=" { return LESSEQ; }
">=" { return GREATEREQ; }
".." { return REC; }
"?//" { return ALTERNATION; }
"."|"?"|"="|";"|","|":"|"|"|"+"|"-"|"*"|"/"|"%"|"\$"|"<"|">" { return yytext[0];}
</requirement>
<requirement name="match-delimiters" stories="lexer">
"["|"{"|"(" {
return enter(yytext[0], YY_START, yyscanner);
}
"]"|"}"|")" {
return try_exit(yytext[0], YY_START, yyscanner);
}
</requirement>
<requirement name="tokenize-format-names" stories="lexer">
"@"[a-zA-Z0-9_]+ {
yylval->literal = jv_string_sized(yytext + 1, yyleng - 1); return FORMAT;
}
</requirement>
<requirement name="tokenize-numbers" stories="lexer">
([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][+-]?[0-9]+)? {
yylval->literal = jv_parse_sized(yytext, yyleng); return LITERAL;
}
</requirement>
<requirement name="tokenize-strings-and-interpolation" stories="lexer">
"\"" {
yy_push_state(IN_QQSTRING, yyscanner);
return QQSTRING_START;
}
<IN_QQSTRING>{
"\\(" {
return enter(QQSTRING_INTERP_START, YY_START, yyscanner);
}
"\"" {
yy_pop_state(yyscanner);
return QQSTRING_END;
}
(\\[^u(]|\\u[a-zA-Z0-9]{0,4})+ {
/* pass escapes to the json parser */
jv escapes = jv_string_fmt("\"%.*s\"", (int)yyleng, yytext);
yylval->literal = jv_parse_sized(jv_string_value(escapes), jv_string_length_bytes(jv_copy(escapes)));
jv_free(escapes);
return QQSTRING_TEXT;
}
[^\\\"]+ {
yylval->literal = jv_string_sized(yytext, yyleng);
return QQSTRING_TEXT;
}
. {
return INVALID_CHARACTER;
}
}
</requirement>
<requirement name="tokenize-identifiers-fields-bindings" stories="lexer">
([a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext); return IDENT;}
\.[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext+1); return FIELD;}
\$([a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext+1); return BINDING;}
</requirement>
<requirement name="skip-whitespace" stories="lexer">
[ \r\n\t]+ {}
</requirement>
<requirement name="reject-invalid-characters" stories="lexer">
. { return INVALID_CHARACTER; }
</requirement>
<unattached story="foundation"/>
<unattached story="corpus-staging"/>
<unattached story="parser"/>
<unattached story="core"/>
<unattached story="constructors"/>
<unattached story="operators"/>
<unattached story="control"/>
<unattached story="bindings"/>
<unattached story="paths"/>
<unattached story="assignment"/>
<unattached story="loops"/>
<unattached story="conversion"/>
<unattached story="collection-builtins"/>
<unattached story="strings"/>
<unattached story="formats"/>
<unattached story="numeric"/>
<unattached story="dates"/>
<unattached story="traversal"/>
<unattached story="io"/>
<unattached story="sql"/>
<unattached story="cli"/>
<unattached story="documentation"/>
<unattached story="scoped-integration"/>
<unattached story="terminal-verification"/>Run artifact