Skip to content

Commit

Permalink
Fixing an error
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosPetrucci committed Jul 10, 2022
1 parent b008585 commit aaa241d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
3 changes: 0 additions & 3 deletions Source/syntax.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ void consume_until(vec_token* vec_tokens, token *curr_token, token* followers, i
int flg_sair = 0;
int i;

//Get the next token
get_token_from_vector(vec_tokens, curr_token);

//Consume tokens while hasn't reach EOF or found a follower
while(strcmp(curr_token->name, "EOF") != 0 && !flg_sair)
{
Expand Down
4 changes: 3 additions & 1 deletion error_file.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Syntax Error: Missing final dot, 8
Syntax Error: Unrecognized term, 4
Lexical Error: Invalid Character, 5
Syntax Error: Missing expected semicolon, 7
10 changes: 6 additions & 4 deletions output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ integer, symb_tipo, 2
begin, symb_begin, 3
x, identifier, 4
:=, simb_atribution, 4
-2, num_int, 4
;, simb_semicolon, 4
@, Lexical Error: Invalid Character, 5
while, symb_while, 5
(, open_parentheses, 5
x, identifier, 5
Expand All @@ -20,7 +20,9 @@ x, identifier, 5
do, symb_do, 5
x, identifier, 6
:=, simb_atribution, 6
2, num_int, 6
;, simb_semicolon, 6
x, identifier, 6
+, op_plus, 6
1, num_int, 6
end, symb_end, 7
EOF, Dread it, run from it, EOF arrives all the same., 8
., simb_dot, 7
EOF, Dread it, run from it, EOF arrives all the same., 7
Expand Down
8 changes: 4 additions & 4 deletions test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
program p_;
var x: integer;
begin
x := -2;
while (x<3) do
x:= 2;
end.
x:= ;
@while (x<3) do
x:=x+1
end.

0 comments on commit aaa241d

Please sign in to comment.