public static LexerSource getSource(String name, byte[] content, List<String> list, ParserConfiguration configuration) { return new ByteArrayLexerSource(name, content, list, configuration.getLineNumber(), configuration.hasExtraPositionInformation()); }
/** * Create a source. * * @param name the name of the source (e.g a filename: foo.rb) * @param content the data of the source * @return the new source */ public static LexerSource getSource(String name, InputStream content, List<String> list, ParserConfiguration configuration) { return new InputStreamLexerSource(name, content, list, configuration.getLineNumber(), configuration.hasExtraPositionInformation()); }
/** * Create a source. * * @param name the name of the source (e.g a filename: foo.rb) * @param content the data of the source * @return the new source */ public static LexerSource getSource(String name, InputStream content, List<String> list, ParserConfiguration configuration) { return new InputStreamLexerSource(name, content, list, configuration.getLineNumber(), configuration.hasExtraPositionInformation()); }
public static LexerSource getSource(String name, byte[] content, List<String> list, ParserConfiguration configuration) { return new ByteArrayLexerSource(name, content, list, configuration.getLineNumber(), configuration.hasExtraPositionInformation()); }
public Node appendToBlock(Node head, Node tail) { if (tail == null) return head; if (head == null) return tail; // Reduces overhead in interp by not set position every single line we encounter. if (!configuration.hasExtraPositionInformation()) { head = compactNewlines(head); } if (!(head instanceof BlockNode)) { head = new BlockNode(head.getPosition()).add(head); } if (warnings.isVerbose() && isBreakStatement(((ListNode) head).getLast())) { warnings.warning(ID.STATEMENT_NOT_REACHED, tail.getPosition(), "Statement not reached."); } // Assumption: tail is never a list node ((ListNode) head).addAll(tail); return head; }
public Node appendToBlock(Node head, Node tail) { if (tail == null) return head; if (head == null) return tail; // Reduces overhead in interp by not set position every single line we encounter. if (!configuration.hasExtraPositionInformation()) { head = compactNewlines(head); } if (!(head instanceof BlockNode)) { head = new BlockNode(head.getPosition()).add(head); } if (warnings.isVerbose() && isBreakStatement(((ListNode) head).getLast())) { warnings.warning(ID.STATEMENT_NOT_REACHED, tail.getPosition(), "Statement not reached."); } // Assumption: tail is never a list node ((ListNode) head).addAll(tail); return head; }