Skip to content

Identifiers with digits not accepted by Smalltalk parser #6

Description

@SamSandq

However, I've identified a bug (or consistency).

  1. Identifiers are letter (letter|digit)*
  2. bootstrap.c accepts the following, and the code works

!
=TextBox
new: lines
|t1|
t1 := TextBox new.
t1 pointer: (t1 basicNew: lines).
^t1
!

  1. However the parser in lst.st does not. E.g., the following (with the last variable p1)

!Simple
run
|w ww wh wx wy bOK bCancel label field box p1|

causes the following error message:

-> File fileIn: 'app.s'
subclass created: Simple
method inserted: action:
method inserted: notification:
Compile error near line 2: illegal method variable declaration
Simple
file in completed

I've traced (and verified) that the error is caused here

!Parser
readMethodVariables
tokenType = $| ifFalse: [ ^ nil ].
self nextLex.
[ self tokenIsName ]
whileTrue: [ self addTempName: token asSymbol. self nextLex ].
tokenType = $|
ifTrue: [ self nextLex ]
ifFalse: [ self error: 'illegal method variable declaration']

and furthermore, that identifiers are actually treated correctly (tokenIsName)... but the code self addTempName: token asSymbol. fails.

I've checked and the code
var := #abc123.

is not accepted by the parser in lst.st --- but is OK for the bootstrapper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions