Common::String MessageState::processString(const char *s) { Common::String outStr; Common::String inStr = Common::String(s); uint index = 0; while (index < inStr.size()) { // Check for hex escape sequence if (stringHex(outStr, inStr, index)) continue; // Check for literal escape sequence if (stringLit(outStr, inStr, index)) continue; // Check for stage direction if (stringStage(outStr, inStr, index)) continue; // None of the above, copy char outStr += inStr[index++]; } return outStr; }
token getTok() { /* skip white space */ while (isspace(ch)) next_ch(); int indLine = line, indCol = col; switch (ch) { case '{': next_ch(); return (token){tk_Lbrace, indLine, indCol, 0, NULL}; case '}': next_ch(); return (token){tk_Rbrace, indLine, indCol, 0, NULL}; case '(': next_ch(); return (token){tk_Lparen, indLine, indCol, 0, NULL}; case ')': next_ch(); return (token){tk_Rparen, indLine, indCol, 0, NULL}; case '+': next_ch(); return (token){tk_Add, indLine, indCol, 0, NULL}; case '-': next_ch(); return (token){tk_Sub, indLine, indCol, 0, NULL}; case '*': next_ch(); return (token){tk_Mul, indLine, indCol, 0, NULL}; case '%': next_ch(); return (token){tk_Mod, indLine, indCol, 0, NULL}; case ';': next_ch(); return (token){tk_Semi, indLine, indCol, 0, NULL}; case ',': next_ch(); return (token){tk_Comma, indLine, indCol, 0, NULL}; case '/': next_ch(); return divOrCmt(indLine, indCol); case '\'': next_ch(); return charLit(ch, indLine, indCol); case '<': next_ch(); return follow('=', tk_Leq, tk_Lss, indLine, indCol); case '>': next_ch(); return follow('=', tk_Geq, tk_Gtr, indLine, indCol); case '=': next_ch(); return follow('=', tk_Eq, tk_Assign, indLine, indCol); case '!': next_ch(); return follow('=', tk_Neq, tk_Not, indLine, indCol); case '&': next_ch(); return follow('&', tk_And, tk_EOI, indLine, indCol); case '|': next_ch(); return follow('|', tk_Or, tk_EOI, indLine, indCol); case '"' : return stringLit(ch, indLine, indCol); case EOF: return (token){tk_EOI, indLine, indCol, 0, NULL}; default: return identOrInt(indLine, indCol); } }