tokiwa-software / fuzion

The Fuzion Language Implementation
https://fuzion-lang.dev
GNU General Public License v3.0
45 stars 9 forks source link

lexer: raise error if num literal is followed by letters. #3258

Closed michaellilltokiwa closed 3 days ago

michaellilltokiwa commented 4 days ago

2386 is actually two issues. This fixes only the first one.

michaellilltokiwa commented 4 days ago
$ fz -e 'say 1ABC'

command line:1:6: error 1: Broken numeric literal, expected anything but a letter following a numeric literal.
say 1ABC
-----^

command line:1:1: error 2: Different count of arguments needed when calling feature
say 1ABC
^^^
Feature not found: 'say' (2 arguments)
Target feature: 'universe'
In call: 'say 1ABC'
To solve this, you might change the actual number of arguments to match the feature 'say' (one argument) at $MODULE/say.fz:31:8:
public say(s Any) => io.out.println s
-------^^^

2 errors.

$ fz -e 'say 1E5ABC'

command line:1:1: error 1: Different count of arguments needed when calling feature
say 1E5ABC
^^^
Feature not found: 'say' (2 arguments)
Target feature: 'universe'
In call: 'say 1E5ABC'
To solve this, you might change the actual number of arguments to match the feature 'say' (one argument) at $MODULE/say.fz:31:8:
public say(s Any) => io.out.println s
-------^^^

one error.

shouldn't the second one also raise this new error?

I think 1E5ABC is a numliteral from the lexers point of view. 1 E 5ABC with E being exponent and 5ABC being a number in hex code.