Skip to content

Commit

Permalink
* When scanning for an identifier, ensure we are still in the
Browse files Browse the repository at this point in the history
          boundaries of the buffer

          Fix for issue #47
  • Loading branch information
yoogx committed Aug 2, 2015
1 parent e656306 commit 3c49520
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/frontends/aadl/ocarina-fe_aadl-lexer.adb
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,9 @@ package body Ocarina.FE_AADL.Lexer is
Display_Name_Buffer (Display_Name_Len) := Buffer (Token_Location.Scan);

Token_Location.Scan := Token_Location.Scan + 1;

while Is_Identifier_Character (Buffer (Token_Location.Scan)) loop
while Token_Location.Scan <= Token_Location.EOF
and then Is_Identifier_Character (Buffer (Token_Location.Scan))
loop
Add_Char_To_Name_Buffer (To_Lower (Buffer (Token_Location.Scan)));

Display_Name_Len := Display_Name_Len + 1;
Expand Down
1 change: 1 addition & 0 deletions tests/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,6 @@ tests/github/issue_22/p.aadl
tests/github/issue_35/test.aadl
tests/github/issue_36/test.aadl
tests/github/issue_39/pb1.aadl
tests/github/issue_47/test.aadl
tests/root_system/test.aadl

6 changes: 6 additions & 0 deletions tests/github/issue_47/test.aadl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package test
public

system s end s;

end test
2 changes: 2 additions & 0 deletions tests/github/issue_47/test.aadl.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test.aadl:6:09: parsing Package_Specification, token ';' is expected, found [EOF]
Cannot parse AADL specifications

0 comments on commit 3c49520

Please sign in to comment.