grmartin / stab-language

Automatically exported from code.google.com/p/stab-language
Apache License 2.0
0 stars 0 forks source link

Better error message #30

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The code following code:

public class Main {

        public static void main(String[] args){
            Main params = new Main();
        }
    }

returns the error message:

error 46: Unexpected lexical unit

The message could be more expressive, for example, "The keywork 'param' is 
reserved, use @param instead, or give another name"

Original issue reported on code.google.com by ice.ta...@gmail.com on 5 Aug 2010 at 9:48

GoogleCodeExporter commented 8 years ago
The same could be found at the code

public class Bar {

        public Map<String, String> params = new HashMap<String, String>();

        public void test(){
        }
    }

which return a diferent message for the same error

error 27: Identifier expected

Original comment by ice.ta...@gmail.com on 5 Aug 2010 at 9:50

GoogleCodeExporter commented 8 years ago
It's very difficult to have a better error message since it happen at the 
syntactic level.
C# is saying "Invalid expression term 'params'" and Java "Syntax error on token 
'xxx'".

Original comment by stab.hac...@gmail.com on 26 Oct 2010 at 11:28