Parser 2.0 (Major Delezer) #52
|
|
@ -425,6 +425,26 @@ f
|
|||
)
|
||||
})
|
||||
|
||||
test('function call w/ parens', () => {
|
||||
expect('echo(bold hello world)').toMatchTokens(
|
||||
{ type: 'Identifier', value: 'echo' },
|
||||
{ type: 'OpenParen' },
|
||||
{ type: 'Identifier', value: 'bold' },
|
||||
{ type: 'Identifier', value: 'hello' },
|
||||
{ type: 'Identifier', value: 'world' },
|
||||
{ type: 'CloseParen' },
|
||||
)
|
||||
|
||||
expect('echo (bold hello world)').toMatchTokens(
|
||||
{ type: 'Identifier', value: 'echo' },
|
||||
{ type: 'OpenParen' },
|
||||
{ type: 'Identifier', value: 'bold' },
|
||||
{ type: 'Identifier', value: 'hello' },
|
||||
{ type: 'Identifier', value: 'world' },
|
||||
{ type: 'CloseParen' },
|
||||
)
|
||||
})
|
||||
|
||||
test('assignment', () => {
|
||||
expect('x = 5').toMatchTokens(
|
||||
{ type: 'Identifier', value: 'x' },
|
||||
|
|
|
|||
|
|
@ -507,6 +507,7 @@ const isWordChar = (ch: number): boolean => {
|
|||
!isWhitespace(ch) &&
|
||||
ch !== 10 /* \n */ &&
|
||||
ch !== 59 /* ; */ &&
|
||||
ch !== 40 /* ( */ &&
|
||||
ch !== 41 /* ) */ &&
|
||||
ch !== 93 /* ] */ &&
|
||||
ch !== -1 /* EOF */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user