Skip to content

Commit

Permalink
Fix lexer for symbols starting with ! (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajreynol authored Nov 6, 2024
1 parent 5b74e02 commit 8619733
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ Token Lexer::computeNextToken()
pushToToken(ch);
switch (ch)
{
case '!': return Token::ATTRIBUTE;
case '(': return Token::LPAREN;
case ')': return Token::RPAREN;
case '|':
Expand Down Expand Up @@ -383,6 +382,12 @@ Token Lexer::tokenizeCurrentSymbol() const
Assert(!d_token.empty());
switch (d_token[0])
{
case '!':
if (d_token.size()==1)
{
return Token::ATTRIBUTE;
}
break;
case '-':
{
if (d_token.size()>=2)
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ set(ethos_test_file_list
left-cons.eo
overload-standalone.eo
simul-overload.eo
bang-lex.eo
)

if(ENABLE_ORACLES)
Expand Down
2 changes: 2 additions & 0 deletions tests/bang-lex.eo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(declare-type Int ())
(declare-const !x Int)

0 comments on commit 8619733

Please sign in to comment.