Skip to content

fix: add namespace keyword, object literal parsing, and namespace body syntax#2

Open
shx20140617 wants to merge 5 commits into
scratch-fuse:mainfrom
shx20140617:main
Open

fix: add namespace keyword, object literal parsing, and namespace body syntax#2
shx20140617 wants to merge 5 commits into
scratch-fuse:mainfrom
shx20140617:main

Conversation

@shx20140617

Copy link
Copy Markdown

Summary: Add namespace to lexer keyword set, add parseObjectLiteral() method for { key: value } expressions, handle namespace name = { body } syntax in parseModuleDeclaration(), add ObjectExpression case in toSource(). Motivation: The builtins package uses namespace motion = { ... } syntax to define Scratch block definitions.

qwen-intl and others added 5 commits June 30, 2026 15:45
…ions

- Update src/parser.ts to correctly handle curly brace tokens ('{') following primary expressions, specifically addressing the scenario where a '{' appears immediately after a primary token which previously caused an "Unexpected token Punctuation: {" error
- Refactor parseCall method to properly manage cases where a block statement follows a primary expression without parentheses
- Introduce parsePrimary method to enhance the parsing logic for primary expressions, improving error handling and token consumption flow
- Adjust .gitignore to ensure source files are correctly tracked (no functional change)
Update from task 229262f4-74dd-4cd4-984d-d3a1efbf947b
…y syntax support

- Add 'namespace' to lexer keyword set
- Add parseObjectLiteral() method for { key: value } expressions in parsePrimary
- Handle 'namespace name = { body }' syntax in parseModuleDeclaration
- Add 'namespace' as alias for 'module' in statement parsing
- Add ObjectExpression case in toSource for code generation
- Add CommentStatement interface and leadingComments to Statement
- Modify loadNextToken to capture comments instead of skipping
- Attach pending comments to statements in parseStatement
- Update toSource to emit leading comments and CommentStatement nodes
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