Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2012
    Location
    Ankara, Turkey
    Posts
    98

    CGS session 23 and "ParseError: no viable alternative at input '<EOF>'"

    Hey all!
    I have been following along with building CGS and everything went fine, but at the end of session 23 I encountered an error! It happened when Nelson around 1:10:00 opens his CGS.g3 and changed
    "COLORHASH : HASH (LETTER | DIGIT)+;"
    to
    "COLORHASH : HASH (LETTER | DIGIT | '-' | '_')+;".
    I discovered that I had a small typo there (I'm not sure anymore but I think I had
    "COLORHASH : HASH (LETTER | DIGIT+);"
    instead of
    "COLORHASH : HASH (LETTER | DIGIT)+;"
    Since this moment (I think) I get THIS error in Unity when trying to load my stylesheet.cgs: "stylesheet.cgs:0:4294967295 ParseError: no viable alternative at input '<EOF>'".
    The thing that really confuses me, however, is that all my tests still pass. So the parsing still seems fine, except that Unity doesn't know what to do anymore.

    So to be clear, I got to the point that I had working buttons and the moving cube etc, but in the last minutes the code broke somewhere

    Anyway here's a part of the CGS.g3 in which Nelson was working:
    Code:
    pseudoSelector:
        COLON IDENT
    	-> PSEUDOSELECTOR[$IDENT, $IDENT.text];
    
    selectorType:
        classSelector | idSelector | elementSelector;
    
    classSelector:
         DOT IDENT 
    	 -> ^(CLASSSELECTOR IDENT);
    
    idSelector:
        COLORHASH 
    	-> ^(IDSELECTOR IDENT[$COLORHASH, $COLORHASH.text.Substring(1)]);
    
    elementSelector:
        IDENT 
    	-> ^(ELEMENTSELECTOR IDENT);
    
    value:
        IDENT | resource | rgbColor | rgbaColor | colorHash | numberValue;
    
    resource:
    	RESOURCE OPAREN STRING CPAREN
    	-> RESOURCE[$STRING, $STRING.text.Substring(1, $STRING.text.Length - 2)];
    
    rgbColor:
    	RGB OPAREN r=NUMBER COMMA g=NUMBER COMMA b=NUMBER CPAREN
    	-> ^(RGB $r $g $b);
    
    rgbaColor:
    	RGBA OPAREN r=NUMBER COMMA g=NUMBER COMMA b=NUMBER COMMA a=NUMBER CPAREN
    	-> ^(RGBA $r $g $b $a);
    
    colorHash:
    	COLORHASH
    	-> COLORHASH[$COLORHASH.text.Substring(1)];
    
    numberValue:
    	  NUMBER PIXELS			-> PIXELS[$NUMBER, $NUMBER.text]
    	| NUMBER POINTS			-> POINTS[$NUMBER, $NUMBER.text]
    	| NUMBER PERCENT		-> PERCENT[$NUMBER, $NUMBER.text]
    	| NUMBER				-> NUMBER;
    
    NUMBER		: '-'? (DOT? DIGIT+ | DIGIT+ DOT DIGIT+);
    PIXELS		: P X;
    POINTS		: P T;
    COLORHASH	: HASH (LETTER | DIGIT | '-' | '_')+;
    RESOURCE	: R E S O U R C E;
    RGBA		: R G B A;
    RGB			: R G B;
    IDENT		: IDENT_START IDENT_MID*;
    STRING		: '\'' ( ~('\n' | '\r' | '\'') )* '\'' |
    			  '"'  ( ~('\n' | '\r' | '"') )*  '"';
    Also, earlier in the CGS series there was a problem that was caused because the difference in European and American decimal writing (, and .). I don't think however that this has anything to do with the current problem..
    Thank you so much for your help!

  2. #2
    Join Date
    Mar 2011
    Location
    Turin
    Posts
    129
    In my version the color hash is defined like:
    COLORHASH : HASH (LETTER | DIGIT | '-' | '_')+;
    the problem could be the space between the HASH and the other part.

  3. #3
    Join Date
    Mar 2011
    Location
    Turin
    Posts
    129
    In my version the color hash is defined like:
    COLORHASH : HASH (LETTER | DIGIT | '-' | '_')+;

    Do you do the teszt unit tests?
    Befor the modification they work?
    the problem could be the space between the HASH and the other part.

  4. #4
    Join Date
    Jul 2012
    Location
    Ankara, Turkey
    Posts
    98
    Het Vaualbus, thanks for answering and thinking with me! I really hope I can fix this problem.
    However, my colorhash definition is the same as yours. And all my 117 or so tests work!
    The error must be caused somewhere else in the code, but I don't know how to debug this totally unclear "no viable alternative at input '<EOF>'" message...

    However, in Unity some of the properties are stil working: when I start the scene I displays a working scroller for the "I am a H1"s. I also see the text of the button, but the button itself not. The slider to move the cube doesn't show up. And ofcourse no colours as well. Note that before the CGS.g3 changes the button and slider and colours did work.

    I must admit that what Nelson is doing goes a bit above my C# skills (which are more around XNA3 level), but I would really like to get this GUI system going!
    Last edited by duifkoe; 08-23-2013 at 04:48 AM.

  5. #5
    Join Date
    Jul 2012
    Location
    Ankara, Turkey
    Posts
    98
    Ok, I fixed the problem! Turned out there was another tiny error in the cgs.g3 code. I also had an error in the stylesheet.cgs itself. Everything works fine now! On to session 24 then!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •