public String getFile() { return src.getFilename(); }
public int lineno() { return ruby_sourceline + src.getLineOffset(); }
IRubyObject verbose = runtime.getVerbose(); runtime.setVerbose(runtime.getNil()); runtime.defineGlobalConstant("DATA", lexerSource.getRemainingAsIO()); runtime.setVerbose(verbose); totalBytes += lexerSource.getOffset();
public void setEncoding(Encoding encoding) { setCurrentEncoding(encoding); src.setEncoding(encoding); lexb.setEncoding(encoding); }
private boolean nextLine() { line_offset += lex_pend; ByteList v = lex_nextline; lex_nextline = null; if (v == null) { if (eofp) return true; if (src == null || (v = src.gets()) == null) { eofp = true; lex_goto_eol(); return true; } cr_seen = false; } addDelayedToken(tokp, lex_pend); if (heredoc_end > 0) { ruby_sourceline = heredoc_end; heredoc_end = 0; } ruby_sourceline++; line_count++; lex_pbeg = lex_p = 0; lex_pend = lex_p + v.length(); lexb = v; flush(); lex_lastline = v; return false; }
public RipperLexer(RipperParserBase parser, LexerSource src) { super(src); this.parser = parser; setState(0); lex_strterm = null; // FIXME: Do we need to parser_prepare like normal lexer? setCurrentEncoding(src.getEncoding()); reset(); }
IRubyObject verbose = runtime.getVerbose(); runtime.setVerbose(runtime.getNil()); runtime.defineGlobalConstant("DATA", lexerSource.getRemainingAsIO()); runtime.setVerbose(verbose); totalBytes += lexerSource.getOffset();
public void setEncoding(Encoding encoding) { setCurrentEncoding(encoding); src.setEncoding(encoding); lexb.setEncoding(encoding); }
private boolean nextLine() { line_offset += lex_pend; ByteList v = lex_nextline; lex_nextline = null; if (v == null) { if (eofp) return true; if (src == null || (v = src.gets()) == null) { eofp = true; lex_goto_eol(); return true; } cr_seen = false; } addDelayedToken(tokp, lex_pend); if (heredoc_end > 0) { ruby_sourceline = heredoc_end; heredoc_end = 0; } ruby_sourceline++; line_count++; lex_pbeg = lex_p = 0; lex_pend = lex_p + v.length(); lexb = v; flush(); lex_lastline = v; return false; }
public RipperLexer(RipperParserBase parser, LexerSource src) { super(src); this.parser = parser; setState(0); lex_strterm = null; // FIXME: Do we need to parser_prepare like normal lexer? setCurrentEncoding(src.getEncoding()); reset(); }
private void initLexer(String title) { LexerSource lexerSource = new ByteListLexerSource(title, 0, new ByteList(utf8Bytes), null); lexerSource.setEncoding(UTF8Encoding.INSTANCE); ParserSupport parserSupport = new ParserSupport(); lexer = new RubyLexer(parserSupport, lexerSource, new NullWarnings(Ruby.getGlobalRuntime())); parserSupport.setLexer(lexer); parserSupport.setConfiguration(new ParserConfiguration(Ruby.getGlobalRuntime(), 0, false, true, false)); parserSupport.setResult(new RubyParserResult()); parserSupport.setWarnings(new NullWarnings(Ruby.getGlobalRuntime())); parserSupport.initTopLocalVariables(); lexer.setState(LexingCommon.EXPR_BEG); }
public int lineno() { return ruby_sourceline + src.getLineOffset(); }
if (eofp) return EOF; if (src == null || (v = src.gets()) == null) { eofp = true; lex_goto_eol();
public String getFile() { return src.getFilename(); }
public void reset() { super.reset(); lex_strterm = null; // FIXME: ripper offsets correctly but we need to subtract one? ruby_sourceline = src.getLineOffset() - 1; parser_prepare(); }
if (eofp) return EOF; if (src == null || (v = src.gets()) == null) { eofp = true; lex_goto_eol();
public void reset() { super.reset(); lex_strterm = null; // FIXME: ripper offsets correctly but we need to subtract one? ruby_sourceline = src.getLineOffset() - 1; parser_prepare(); }