public ParserImpl(Scanner scanner) { this.scanner = scanner; currentEvent = null; directives = new VersionTagsTuple(null, new HashMap<String, String>(DEFAULT_TAGS)); states = new ArrayStack<Production>(100); marks = new ArrayStack<Mark>(10); state = new ParseStreamStart(); }
public ScannerImpl(StreamReader reader) { this.reader = reader; this.tokens = new ArrayList<Token>(100); this.indents = new ArrayStack<Integer>(10); // The order in possibleSimpleKeys is kept for nextPossibleSimpleKey() this.possibleSimpleKeys = new LinkedHashMap<Integer, SimpleKey>(); fetchStreamStart();// Add the STREAM-START token. }
public ParserImpl(StreamReader reader) { this.scanner = new ScannerImpl(reader); currentEvent = null; directives = new VersionTagsTuple(null, new HashMap<String, String>(DEFAULT_TAGS)); states = new ArrayStack<Production>(100); marks = new ArrayStack<Mark>(10); state = new ParseStreamStart(); }
public ParserImpl(final StreamReader reader) { this.scanner = new ScannerImpl(reader); currentEvent = null; directives = new VersionTagsTuple(null, new HashMap<String, String>(DEFAULT_TAGS)); states = new ArrayStack<Production>(100); marks = new ArrayStack<Mark>(10); state = new ParseStreamStart(); }
public ScannerImpl(final StreamReader reader) { this.reader = reader; this.tokens = new ArrayList<Token>(100); this.indents = new ArrayStack<Integer>(10); // The order in possibleSimpleKeys is kept for nextPossibleSimpleKey() this.possibleSimpleKeys = new LinkedHashMap<Integer, SimpleKey>(); fetchStreamStart();// Add the STREAM-START token. }
public Emitter(Writer stream, DumperOptions opts) { // The stream should have the methods `write` and possibly `flush`. this.stream = stream; // Emitter is a state machine with a stack of states to handle nested // structures. this.states = new ArrayStack<EmitterState>(100); this.state = new ExpectStreamStart(); // Current event and the event queue. this.events = new ArrayBlockingQueue<Event>(100); this.event = null; // The current indentation level and the stack of previous indents. this.indents = new ArrayStack<Integer>(10); this.indent = null; // Flow level. this.flowLevel = 0; // Contexts. mappingContext = false; simpleKeyContext = false; // // Characteristics of the last emitted character: // - current position. // - is it a whitespace? // - is it an indention character // (indentation space, '-', '?', or ':')? column = 0; whitespace = true; indention = true; // Whether the document requires an explicit document indicator openEnded = false; // Formatting details. this.canonical = opts.isCanonical(); this.prettyFlow = opts.isPrettyFlow(); this.allowUnicode = opts.isAllowUnicode(); this.bestIndent = 2; if ((opts.getIndent() > MIN_INDENT) && (opts.getIndent() < MAX_INDENT)) { this.bestIndent = opts.getIndent(); } this.indicatorIndent = opts.getIndicatorIndent(); this.bestWidth = 80; if (opts.getWidth() > this.bestIndent * 2) { this.bestWidth = opts.getWidth(); } this.bestLineBreak = opts.getLineBreak().getString().toCharArray(); this.splitLines = opts.getSplitLines(); // Tag prefixes. this.tagPrefixes = new LinkedHashMap<String, String>(); // Prepared anchor and tag. this.preparedAnchor = null; this.preparedTag = null; // Scalar analysis and style. this.analysis = null; this.style = null; }
public Emitter(Serialization serialization, Writer stream, DumperOptions opts) { this.serialization = serialization; // The stream should have the methods `write` and possibly `flush`. this.stream = stream; // Emitter is a state machine with a stack of states to handle nested // structures. this.states = new ArrayStack<>(100); this.state = new ExpectStreamStart(); // Current event and the event queue. this.events = new ArrayBlockingQueue<>(100); this.event = null; // The current indentation level and the stack of previous indents. this.indents = new ArrayStack<>(10); this.indent = null; // Flow level. this.flowLevel = 0; // Contexts. this.mappingContext = false; this.simpleKeyContext = false; // // Characteristics of the last emitted character: // - current position. // - is it a whitespace? // - is it an indention character // (indentation space, '-', '?', or ':')? this.column = 0; this.whitespace = true; this.indention = true; // Whether the document requires an explicit document indicator this.openEnded = false; // Formatting details. this.canonical = opts.isCanonical(); this.prettyFlow = opts.isPrettyFlow(); this.allowUnicode = opts.isAllowUnicode(); this.bestIndent = 2; if ((opts.getIndent() > MIN_INDENT) && (opts.getIndent() < MAX_INDENT)) { this.bestIndent = opts.getIndent(); } this.indicatorIndent = getIndicatorIndent.applyAsInt(opts); // compatibility this.bestWidth = BEST_WIDTH; if (opts.getWidth() > (this.bestIndent * 2)) { this.bestWidth = opts.getWidth(); } this.bestLineBreak = opts.getLineBreak().getString().toCharArray(); this.splitLines = getSplitLines.test(opts); // compatibility this.longCommentThreshold = opts.getLongCommentThreshold(); this.longCommentBorder = opts.getLongCommentBorder(); this.longCommentBorderStartsWithComment = ! this.longCommentBorder.isEmpty() && (this.longCommentBorder.charAt(0) == '#'); this.longCommentRightBorder = opts.getLongCommentRightBorder(); // Tag prefixes. this.tagPrefixes = new LinkedHashMap<>(10); // Prepared anchor and tag. this.preparedAnchor = null; this.preparedTag = null; // Scalar analysis and style. this.analysis = null; this.style = null; }
public Emitter(Serialization serialization, Writer stream, DumperOptions opts) { this.serialization = serialization; // The stream should have the methods `write` and possibly `flush`. this.stream = stream; // Emitter is a state machine with a stack of states to handle nested // structures. this.states = new ArrayStack<>(100); this.state = new ExpectStreamStart(); // Current event and the event queue. this.events = new ArrayBlockingQueue<>(100); this.event = null; // The current indentation level and the stack of previous indents. this.indents = new ArrayStack<>(10); this.indent = null; // Flow level. this.flowLevel = 0; // Contexts. this.mappingContext = false; this.simpleKeyContext = false; // // Characteristics of the last emitted character: // - current position. // - is it a whitespace? // - is it an indention character // (indentation space, '-', '?', or ':')? this.column = 0; this.whitespace = true; this.indention = true; // Whether the document requires an explicit document indicator this.openEnded = false; // Formatting details. this.canonical = opts.isCanonical(); this.prettyFlow = opts.isPrettyFlow(); this.allowUnicode = opts.isAllowUnicode(); this.bestIndent = 2; if ((opts.getIndent() > MIN_INDENT) && (opts.getIndent() < MAX_INDENT)) { this.bestIndent = opts.getIndent(); } this.indicatorIndent = opts.getIndicatorIndent(); this.bestWidth = BEST_WIDTH; if (opts.getWidth() > (this.bestIndent * 2)) { this.bestWidth = opts.getWidth(); } this.bestLineBreak = opts.getLineBreak().getString().toCharArray(); this.splitLines = opts.getSplitLines(); this.longCommentThreshold = opts.getLongCommentThreshold(); this.longCommentBorder = opts.getLongCommentBorder(); this.longCommentBorderStartsWithComment = ! this.longCommentBorder.isEmpty() && (this.longCommentBorder.charAt(0) == '#'); this.longCommentRightBorder = opts.getLongCommentRightBorder(); // Tag prefixes. this.tagPrefixes = new LinkedHashMap<>(10); // Prepared anchor and tag. this.preparedAnchor = null; this.preparedTag = null; // Scalar analysis and style. this.analysis = null; this.style = null; }
public Emitter(Writer stream, DumperOptions opts) { // The stream should have the methods `write` and possibly `flush`. this.stream = stream; // Emitter is a state machine with a stack of states to handle nested // structures. this.states = new ArrayStack<EmitterState>(100); this.state = new ExpectStreamStart(); // Current event and the event queue. this.events = new ArrayBlockingQueue<Event>(100); this.event = null; // The current indentation level and the stack of previous indents. this.indents = new ArrayStack<Integer>(10); this.indent = null; // Flow level. this.flowLevel = 0; // Contexts. mappingContext = false; simpleKeyContext = false; // // Characteristics of the last emitted character: // - current position. // - is it a whitespace? // - is it an indention character // (indentation space, '-', '?', or ':')? column = 0; whitespace = true; indention = true; // Whether the document requires an explicit document indicator openEnded = false; // Formatting details. this.canonical = opts.isCanonical(); this.prettyFlow = opts.isPrettyFlow(); this.allowUnicode = opts.isAllowUnicode(); this.bestIndent = 2; if ((opts.getIndent() > MIN_INDENT) && (opts.getIndent() < MAX_INDENT)) { this.bestIndent = opts.getIndent(); } this.bestWidth = 80; if (opts.getWidth() > this.bestIndent * 2) { this.bestWidth = opts.getWidth(); } this.bestLineBreak = opts.getLineBreak().getString().toCharArray(); this.splitLines = opts.getSplitLines(); // Tag prefixes. this.tagPrefixes = new LinkedHashMap<String, String>(); // Prepared anchor and tag. this.preparedAnchor = null; this.preparedTag = null; // Scalar analysis and style. this.analysis = null; this.style = null; }
public Emitter(Writer stream, DumperOptions opts) { // The stream should have the methods `write` and possibly `flush`. this.stream = stream; // Emitter is a state machine with a stack of states to handle nested // structures. this.states = new ArrayStack<EmitterState>(100); this.state = new ExpectStreamStart(); // Current event and the event queue. this.events = new ArrayBlockingQueue<Event>(100); this.event = null; // The current indentation level and the stack of previous indents. this.indents = new ArrayStack<Integer>(10); this.indent = null; // Flow level. this.flowLevel = 0; // Contexts. mappingContext = false; simpleKeyContext = false; // // Characteristics of the last emitted character: // - current position. // - is it a whitespace? // - is it an indention character // (indentation space, '-', '?', or ':')? column = 0; whitespace = true; indention = true; // Whether the document requires an explicit document indicator openEnded = false; // Formatting details. this.canonical = opts.isCanonical(); this.prettyFlow = opts.isPrettyFlow(); this.allowUnicode = opts.isAllowUnicode(); this.bestIndent = 2; if ((opts.getIndent() > MIN_INDENT) && (opts.getIndent() < MAX_INDENT)) { this.bestIndent = opts.getIndent(); } this.bestWidth = 80; if (opts.getWidth() > this.bestIndent * 2) { this.bestWidth = opts.getWidth(); } this.bestLineBreak = opts.getLineBreak().getString().toCharArray(); // Tag prefixes. this.tagPrefixes = new LinkedHashMap<String, String>(); // Prepared anchor and tag. this.preparedAnchor = null; this.preparedTag = null; // Scalar analysis and style. this.analysis = null; this.style = null; this.options = opts; }