protected boolean isNext_identchar() throws IOException { int c = nextc(); pushback(c); return c != EOF && (Character.isLetterOrDigit(c) || c == '_'); }
protected boolean isNext_identchar() throws IOException { int c = nextc(); pushback(c); return c != EOF && (Character.isLetterOrDigit(c) || c == '_'); }
protected char scanOct(int count) throws IOException { char value = '\0'; for (int i = 0; i < count; i++) { int c = nextc(); if (!isOctChar(c)) { pushback(c); break; } value <<= 3; value |= Integer.parseInt(String.valueOf((char) c), 8); } return value; }
protected char scanOct(int count) throws IOException { char value = '\0'; for (int i = 0; i < count; i++) { int c = nextc(); if (!isOctChar(c)) { pushback(c); break; } value <<= 3; value |= Integer.parseInt(String.valueOf((char) c), 8); } return value; }
protected int numberLiteralSuffix(int mask) throws IOException { int c = nextc(); if (c == 'i') return (mask & SUFFIX_I) != 0 ? mask & SUFFIX_I : 0; if (c == 'r') { int result = 0; if ((mask & SUFFIX_R) != 0) result |= (mask & SUFFIX_R); if (peek('i') && (mask & SUFFIX_I) != 0) { c = nextc(); result |= (mask & SUFFIX_I); } return result; } if (c == '.') { int c2 = nextc(); if (Character.isDigit(c2)) { compile_error("unexpected fraction part after numeric literal"); do { // Ripper does not stop so we follow MRI here and read over next word... c2 = nextc(); } while (isIdentifierChar(c2)); } else { pushback(c2); } } pushback(c); return 0; }
protected int numberLiteralSuffix(int mask) throws IOException { int c = nextc(); if (c == 'i') return (mask & SUFFIX_I) != 0 ? mask & SUFFIX_I : 0; if (c == 'r') { int result = 0; if ((mask & SUFFIX_R) != 0) result |= (mask & SUFFIX_R); if (peek('i') && (mask & SUFFIX_I) != 0) { c = nextc(); result |= (mask & SUFFIX_I); } return result; } if (c == '.') { int c2 = nextc(); if (Character.isDigit(c2)) { compile_error("unexpected fraction part after numeric literal"); do { // Ripper does not stop so we follow MRI here and read over next word... c2 = nextc(); } while (isIdentifierChar(c2)); } else { pushback(c2); } } pushback(c); return 0; }
public boolean tokadd_ident(int c) { do { if (!tokadd_mbchar(c)) return false; c = nextc(); } while (isIdentifierChar(c)); pushback(c); return true; }
public boolean tokadd_ident(int c) { do { if (!tokadd_mbchar(c)) return false; c = nextc(); } while (isIdentifierChar(c)); pushback(c); return true; }
public int peekVariableName(int tSTRING_DVAR, int tSTRING_DBEG) throws IOException { int c = nextc(); // byte right after # int significant = -1; switch (c) { case '$': { // we unread back to before the $ so next lex can read $foo int c2 = nextc(); int c3 = nextc(); int c2 = nextc(); int c3 = nextc();
public int peekVariableName(int tSTRING_DVAR, int tSTRING_DBEG) throws IOException { int c = nextc(); // byte right after # int significant = -1; switch (c) { case '$': { // we unread back to before the $ so next lex can read $foo int c2 = nextc(); int c3 = nextc(); int c2 = nextc(); int c3 = nextc();
public void parser_prepare() { int c = nextc(); switch(c) { case '#': if (peek('!')) has_shebang = true; break; case 0xef: if (lex_pend - lex_p >= 2 && p(lex_p) == 0xbb && p(lex_p + 1) == 0xbf) { setEncoding(UTF8_ENCODING); lex_p += 2; lex_pbeg = lex_p; return; } break; case EOF: return; } pushback(c); current_enc = lex_lastline.getEncoding(); }
public void parser_prepare() { int c = nextc(); switch(c) { case '#': if (peek('!')) has_shebang = true; break; case 0xef: if (lex_pend - lex_p >= 2 && p(lex_p) == 0xbb && p(lex_p + 1) == 0xbf) { setEncoding(UTF8_ENCODING); lex_p += 2; lex_pbeg = lex_p; return; } break; case EOF: return; } pushback(c); current_enc = lex_lastline.getEncoding(); }