Skip to content

Commit

Permalink
Turn ident into a state.
Browse files Browse the repository at this point in the history
  • Loading branch information
thesoftwarephilosopher committed Aug 22, 2024
1 parent db1e42c commit 73e0aab
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions site/token-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,28 @@ export const tokenProvider = {
[/[\w$]+/, 'function', '@pop'],
],

common: [
// identifiers and keywords
ident: [
// [/#?[\w$]+\s*(?=[<(])/, 'method'],
// [/#?[\w$]+\s*(?=[=.])/, 'property'],
[
/#?[a-z_$][\w$]*/,
{
cases: {
'new': { token: 'keyword', next: '@newtype' },
'function': { token: 'keyword', next: '@function' },
// 'class': { token: 'keyword', next: '@function' }, // TODO: uncomment after JSX works
'@keywords': 'keyword',
'@default': 'identifier'
'@keywords': { token: 'keyword', next: '@pop' },
'@default': { token: 'identifier', next: '@pop' },
}
}
],
[/[A-Z][\w\$]*/, 'type.identifier'],
[/./, '@rematch', '@pop'],
],

// [/#?[\w$]+\s*(?=[<(])/, 'method'],
// [/#?[\w$]+\s*(?=[=.])/, 'property'],
common: [
// identifiers and keywords
[/#?[a-zA-Z_$][\w$]*/, '@rematch', '@ident'],

// whitespace
{ include: '@whitespace' },
Expand Down

0 comments on commit 73e0aab

Please sign in to comment.