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

Create lexer for ucode #879

Merged
merged 1 commit into from Nov 7, 2023
Merged

Create lexer for ucode #879

merged 1 commit into from Nov 7, 2023

Conversation

eric-j-ason
Copy link
Contributor

The ucode language is "a tiny general purpose scripting language featuring a syntax closely resembling ECMAScript". It was created for use in OpenWrt, the Linux distribution commonly used in routers and other embedded devices.

I used the JavaScript lexer as the starting point, and removed the keywords not used in ucode (and added one or two).

Questions:

  • What is the difference between Keyword and KeywordReserved? The JavaScript lexer uses both, but I don't see the pattern.
  • Should KeywordNamespace be used for import, as, from, and maybe export? The JavaScript lexer does not use it, but the Python one does.

@alecthomas
Copy link
Owner

In some languages, a "reserved keyword" is a keyword that cannot be used for user defined symbols in any context. Other keywords can be

@alecthomas
Copy link
Owner

Basically there's no right or wrong answer, just use your best judgement. You can be more or less specific, as required.

@alecthomas
Copy link
Owner

I'd suggest adding some tests. See the README in lexers/testdata for details.

@alecthomas alecthomas merged commit 8f938d0 into alecthomas:master Nov 7, 2023
2 checks passed
@eric-j-ason
Copy link
Contributor Author

eric-j-ason commented Nov 8, 2023

I'd suggest adding some tests. See the README in lexers/testdata for details.

I will do so.

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.

None yet

2 participants