From b5cb655b099b57d45dfc13d79ce94779dccf4126 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sat, 24 Sep 2016 14:19:24 +0200 Subject: Added comments --- doc/grammar.tex | 8 ++++++-- interpreter/lex.c | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/grammar.tex b/doc/grammar.tex index 59026bd..65ec537 100644 --- a/doc/grammar.tex +++ b/doc/grammar.tex @@ -5,9 +5,13 @@ \setlength{\grammarparsep}{4pt} \setlength{\grammarindent}{10em} \begin{grammar} - ::= + ::= - ::= `;' | + ::= `;' + \alt + \alt + + ::= `//' \dots `\textbackslash n' ::= `=' diff --git a/interpreter/lex.c b/interpreter/lex.c index 180c23e..8946252 100644 --- a/interpreter/lex.c +++ b/interpreter/lex.c @@ -66,6 +66,10 @@ token_list* lex(token_list* list, char* input) { case ',': list->elem.kind = TOKEN_COMMA; break; case '!': list->elem.kind = TOKEN_STRICT; break; default: + if (input[0] == '/' && input[1] == '/') { + while (input && input[0] != '\n') input++; + break; + } if (input[0] == 'c' && input[1] == 'o' && input[2] == 'd' && input[3] == 'e' && is_space_char(input[4])) { list->elem.kind = TOKEN_CODE; -- cgit v1.2.3