org.yaml.snakeyaml.util.ArrayStack Java Examples

The following examples show how to use org.yaml.snakeyaml.util.ArrayStack. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ParserImpl.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
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();
}
 
Example #2
Source File: ScannerImpl.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
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.
}
 
Example #3
Source File: ParserImpl.java    From snake-yaml with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example #4
Source File: ScannerImpl.java    From snake-yaml with Apache License 2.0 5 votes vote down vote up
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.
}
 
Example #5
Source File: Emitter.java    From orion.server with Eclipse Public License 1.0 4 votes vote down vote up
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;
}
 
Example #6
Source File: Emitter.java    From snake-yaml with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example #7
Source File: Emitter.java    From Diorite with MIT License 4 votes vote down vote up
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;
}