コード例 #1
0
 public bool expectToken(string tokStr, TokenCategory tc)
 {
     if (Curs.TokenObj.TokenCategory == tc && Curs.TokenObj.theToken.Equals(tokStr))
     {   // we match the category and the string
         return(Curs.advance());
     }
     throw new FormatException($"Fatal Format Error in {TokFile.FilePath}:\n\t Expected <{tokStr}:{tc}> got <{Curs.TokenObj.theToken}:{Curs.TokenObj.TokenCategory}>.");
     // return FileIsValid = false;
 }
コード例 #2
0
 static void parseToValueFor(CKanFormat bar, string S)
 {
     TokenFile.Cursor Curs = bar.MoveCursTo(S);
     //WARNING This is awful, but I did it anyways....
     // This as side effect sets the global variable IndentationGloabalHack to the whitespace preceding nameField
     // just in case someone needs it later read allthe code everywher to see how this works or doesnt.
     // p.IndentationHack = Curs.TokenObj.WhiteSpace;
     Curs.advance();                            // advance over the just found identifier Token
     // does not accept EOL between name and ":"
     bar.expectToken(":", TokenCategory.Token); //advance over the ":"  NO EOLS allowed
     bar.skipEOL();                             // skips all EOLS and WS
     return;                                    // Cursor points to Value String OR [ OR { dependign on Namevalue Type
 }