fix: improve parser - fix ASCII strings and comment indentation handling

- Remove 'asciiend' from ascii_string grammar rule (handled by scanner)
- Add scanner logic to skip comment-only lines when measuring indentation
- Update scanner to include 'asciiend' in ASCII_CONTENT token
- Implement external scanner for BLOCK_COMMENT (partial fix)

Results: Reduced parse errors from 156 to 119 (23% improvement)
This commit is contained in:
2025-11-27 11:09:32 +01:00
parent 06e6e3b098
commit 36d6c3947a
7 changed files with 15566 additions and 15434 deletions

View File

@@ -8,7 +8,6 @@ module.exports = grammar({
choice(
$._newline,
$.comment,
$.block_comment,
// Keyword-based statements (must come before generic command)
$.variable_declaration, // 'var'
$.function_declaration, // 'func'
@@ -31,12 +30,6 @@ module.exports = grammar({
// Comments
comment: $ => token(seq('//', /.*/)),
block_comment: $ => token(seq(
'/*',
/[^*]*\*+(?:[^/*][^*]*\*+)*/,
'/'
)),
// Variable declaration
variable_declaration: $ => seq(
'var',
@@ -282,7 +275,7 @@ module.exports = grammar({
null: $ => 'null',
ascii_string: $ => seq('ascii', $.ascii_content, 'asciiend')
ascii_string: $ => seq('ascii', $.ascii_content)
},
extras: $ => [
@@ -296,7 +289,8 @@ module.exports = grammar({
$._newline,
$._indent,
$._dedent,
$.ascii_content
$.ascii_content,
$.block_comment
],
word: $ => $.identifier,