Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler goes into loop when encountering special characters #8

Open
bsynchron opened this issue Jun 5, 2020 · 6 comments
Open

Compiler goes into loop when encountering special characters #8

bsynchron opened this issue Jun 5, 2020 · 6 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@bsynchron
Copy link

When starting a line with # or @ the compiler should throw an error,
instead it only loops

@bsynchron
Copy link
Author

  • not only the start of a line its everywhere except in strings

@bsynchron
Copy link
Author

  • Also when there is only a string without anything else

@philippwiesner
Copy link
Owner

Issue is probably related to the parse_statement function:

while loop_control:

  self.__parse_identifier_statement()
  self.__parse_return_statement()
  self.__parse_loop_control_statements(Tag.BREAK)
  self.__parse_loop_control_statements(Tag.CONTINUE)
  self.__parse_while_statement()
  self.__parse_if_statement()

  if self.__lookahead(Tag.FUNC):
    self.__parse_block()

   elif self.__lookahead('}'):
     loop_control = False

We don't throw an Syntax error or exit the loop, when something else than expected is in the token_stream

@philippwiesner
Copy link
Owner

  • Also when there is only a string without anything else

What do you mean with strings without anything?

@philippwiesner philippwiesner self-assigned this Jun 5, 2020
@philippwiesner philippwiesner added bug Something isn't working enhancement New feature or request labels Jun 5, 2020
@bsynchron
Copy link
Author

func test(){ "Some string"; }

Thats what I mean by "without anything"

@bsynchron
Copy link
Author

bsynchron commented Jun 5, 2020

FYI: This compiles

func test(){
   j: int = (1/0);
   Some text that really should cause the compiler to break;
   return j;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants