summaryrefslogtreecommitdiffhomepage
path: root/lexer.c
diff options
context:
space:
mode:
Diffstat (limited to 'lexer.c')
-rw-r--r--lexer.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lexer.c b/lexer.c
index 5950387..1be6978 100644
--- a/lexer.c
+++ b/lexer.c
@@ -1047,6 +1047,13 @@ lex_step(uc_lexer *lex, FILE *fp)
return NULL;
}
+ /* in raw code mode, ignore template tag tokens */
+ if (lex->config && lex->config->raw_mode &&
+ (tok->type == TK_LSTM || tok->type == TK_RSTM ||
+ tok->type == TK_LEXP || tok->type == TK_REXP)) {
+ continue;
+ }
+
/* disallow nesting blocks */
if (tok->type == TK_LSTM || tok->type == TK_LEXP) {
buf_consume(lex, tok->plen);
@@ -1188,6 +1195,11 @@ uc_lexer_init(uc_lexer *lex, uc_parse_config *config, uc_source *source)
lex->lastoff = 0;
+ if (config && config->raw_mode) {
+ lex->state = UT_LEX_IDENTIFY_TOKEN;
+ lex->block = STATEMENTS;
+ }
+
/* Skip any potential interpreter line */
if (lex->source->off == 0)
uc_lexer_skip_shebang(lex);