Skip to content

New tokens and bug fix#34

Draft
Pacsfury wants to merge 6 commits into
azin-lang:devfrom
Pacsfury:patch-1
Draft

New tokens and bug fix#34
Pacsfury wants to merge 6 commits into
azin-lang:devfrom
Pacsfury:patch-1

Conversation

@Pacsfury

@Pacsfury Pacsfury commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Add compound assignment, increment/decrement, and shift operators to the lexer

Summary

Extends the lexer to recognize compound assignment operators, increment/decrement operators, and bitwise shift operators, which were previously unsupported. Also fixes an unterminated string literal bug where a missing closing quote followed by a newline was silently accepted instead of raising a diagnostic.

Changes

token.hpp

  • Added 12 new token_kind enumerators:
    • Compound assignment: plus_equal, minus_equal, star_equal, slash_equal, modulo_equal, caret_equal, pipe_equal, ampersand_equal
    • Increment/decrement: plus_plus, minus_minus
    • Shifts: less_less, greater_greater
  • Added corresponding cases to token_kind_to_string.

lexer.cpp

  • Updated scan_token to recognize the new operators via match() chains (e.g. += before ++ before +), covering:
    • +, -, *, /, %, ^, |, & compound assignment forms
    • ++, --
    • <<, >>
  • Fixed string(): unterminated string detection now also triggers when a newline is hit before the closing ", not just at EOF. Previously this case fell through and silently consumed the newline as if it were the closing quote, producing a corrupted token with no diagnostic.

@spatulari

Copy link
Copy Markdown
Contributor

Thank you for the contribution, but the lexer is going through some massive changes right now, could you readd those tokens once it's finished? Sorry. (Check pr #33 )

@Pacsfury

Pacsfury commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Ok. I will convert this to draft until PR #33 is merged and I will readd everything

@Pacsfury Pacsfury marked this pull request as draft July 9, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants