Package org.yaml.snakeyaml.error

Examples of org.yaml.snakeyaml.error.Mark


        RubyKernel.raise(context, runtime.getKernel(), new IRubyObject[] { exception }, Block.NULL_BLOCK);
    }

    private static void raiseParserException(ThreadContext context, IRubyObject yaml, MarkedYAMLException mye, IRubyObject rbPath) {
        Ruby runtime;
        Mark mark;
        RubyClass se;
        IRubyObject exception;

        runtime = context.runtime;
        se = (RubyClass)runtime.getModule("Psych").getConstant("SyntaxError");

        mark = mye.getProblemMark();

        exception = se.newInstance(context,
                new IRubyObject[] {
                    rbPath,
                    runtime.newFixnum(mark.getLine() + 1),
                    runtime.newFixnum(mark.getColumn() + 1),
                    runtime.newFixnum(mark.getIndex()),
                    (null == mye.getProblem() ? runtime.getNil() : runtime.newString(mye.getProblem())),
                    (null == mye.getContext() ? runtime.getNil() : runtime.newString(mye.getContext()))
                },
                Block.NULL_BLOCK);
View Full Code Here


                    runtime.newFixnum(0),
                    Block.NULL_BLOCK
            );
        }

        Mark mark = event.getStartMark();

        return ((RubyClass)context.runtime.getClassFromPath("Psych::Parser::Mark")).newInstance(
                context,
                runtime.newFixnum(mark.getIndex()),
                runtime.newFixnum(mark.getLine()),
                runtime.newFixnum(mark.getColumn()),
                Block.NULL_BLOCK
        );
    }
View Full Code Here

    public void testGetToken() {
        String data = "string: abcd";
        StreamReader reader = new StreamReader(data);
        Scanner scanner = new ScannerImpl(reader);
        Mark dummy = new Mark("dummy", 0, 0, 0, "", 0);
        LinkedList<Token> etalonTokens = new LinkedList<Token>();
        etalonTokens.add(new StreamStartToken(dummy, dummy));
        etalonTokens.add(new BlockMappingStartToken(dummy, dummy));
        etalonTokens.add(new KeyToken(dummy, dummy));
        etalonTokens.add(new ScalarToken("string", true, dummy, dummy, (char) 0));
View Full Code Here

    public CanonicalScanner(String data) {
        this.data = data + "\0";
        this.index = 0;
        this.tokens = new ArrayList<Token>();
        this.scanned = false;
        this.mark = new Mark("test", 0, 0, 0, data, 0);
    }
View Full Code Here

        assertEquals(Tag.INT, node.getTag());
        assertEquals("3", node.getValue());
        // not sure whether it should be null or 0
        assertEquals(Character.valueOf('\u0000'), node.getStyle());
        assertEquals(Object.class, node.getType());
        Mark mark = node.getStartMark();
        assertEquals(0, mark.getColumn());
        assertEquals(0, mark.getLine());
        assertEquals("'reader'", mark.getName());
        assertEquals("    3\n    ^", mark.get_snippet());
        assertEquals("<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:int, value=3)>",
                node.toString());
    }
View Full Code Here

            assertEquals("tag in a Node is required.", e.getMessage());
        }
    }

    public void testGetEndMark() {
        Mark mark1 = new Mark("name", 5, 2, 12, "afd asd asd", 7);
        Mark mark2 = new Mark("name", 6, 3, 13, "afd asd asd", 8);
        Node node = new ScalarNode(new Tag("!foo"), "bla-bla", mark1, mark2, '"');
        assertEquals(mark1, node.getStartMark());
        assertEquals(mark2, node.getEndMark());
    }
View Full Code Here

    public void testGetEvent() {
        String data = "string: abcd";
        StreamReader reader = new StreamReader(data);
        Parser parser = new ParserImpl(reader);
        Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
        LinkedList<Event> etalonEvents = new LinkedList<Event>();
        etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
        etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
        etalonEvents.add(new MappingStartEvent(null, null, true, dummyMark, dummyMark,
                Boolean.FALSE));
View Full Code Here

    public void testGetEvent2() {
        String data = "american:\n  - Boston Red Sox";
        StreamReader reader = new StreamReader(data);
        Parser parser = new ParserImpl(reader);
        Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
        LinkedList<Event> etalonEvents = new LinkedList<Event>();
        etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
        etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
        etalonEvents
                .add(new MappingStartEvent(null, null, true, dummyMark, dummyMark, Boolean.TRUE));
View Full Code Here

import org.yaml.snakeyaml.tokens.Token.ID;

public class FlowSequenceStartTokenTest extends TestCase {

    public void testGetTokenId() {
        Mark mark = new Mark("test1", 0, 0, 0, "*The first line.\nThe last line.", 0);
        FlowSequenceStartToken token = new FlowSequenceStartToken(mark, mark);
        assertEquals(ID.FlowSequenceStart, token.getTokenId());
    }
View Full Code Here

import org.yaml.snakeyaml.tokens.Token.ID;

public class BlockSequenceStartTokenTest extends TestCase {

    public void testGetTokenId() {
        Mark mark = new Mark("test1", 0, 0, 0, "*The first line.\nThe last line.", 0);
        BlockSequenceStartToken token = new BlockSequenceStartToken(mark, mark);
        assertEquals(ID.BlockSequenceStart, token.getTokenId());
    }
View Full Code Here

TOP

Related Classes of org.yaml.snakeyaml.error.Mark

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.