Examples of DirectiveToken


Examples of com.esotericsoftware.yamlbeans.tokenizer.DirectiveToken

  }

  DocumentStartEvent processDirectives (boolean explicit) {
    documentVersion = null;
    while (tokenizer.peekNextTokenType() == DIRECTIVE) {
      DirectiveToken token = (DirectiveToken)tokenizer.getNextToken();
      if (token.getDirective().equals("YAML")) {
        if (documentVersion != null) throw new ParserException("Duplicate YAML directive.");
        documentVersion = new Version(token.getValue());
        if (documentVersion.major != 1)
          throw new ParserException("Unsupported YAML version (1.x is required): " + documentVersion);
      } else if (token.getDirective().equals("TAG")) {
        String[] values = token.getValue().split(" ");
        String handle = values[0];
        String prefix = values[1];
        if (tagHandles.containsKey(handle)) throw new ParserException("Duplicate tag directive: " + handle);
        tagHandles.put(handle, prefix);
      }
View Full Code Here

Examples of com.esotericsoftware.yamlbeans.tokenizer.DirectiveToken

  }

  DocumentStartEvent processDirectives (boolean explicit) {
    documentVersion = null;
    while (tokenizer.peekNextTokenType() == DIRECTIVE) {
      DirectiveToken token = (DirectiveToken)tokenizer.getNextToken();
      if (token.getDirective().equals("YAML")) {
        if (documentVersion != null) throw new ParserException("Duplicate YAML directive.");
        documentVersion = new Version(token.getValue());
        if (documentVersion.major != 1)
          throw new ParserException("Unsupported YAML version (1.x is required): " + documentVersion);
      } else if (token.getDirective().equals("TAG")) {
        String[] values = token.getValue().split(" ");
        String handle = values[0];
        String prefix = values[1];
        if (tagHandles.containsKey(handle)) throw new ParserException("Duplicate tag directive: " + handle);
        tagHandles.put(handle, prefix);
      }
View Full Code Here

Examples of org.yaml.snakeyaml.tokens.DirectiveToken

    @SuppressWarnings("unchecked")
    private VersionTagsTuple processDirectives() {
        Version yamlVersion = null;
        HashMap<String, String> tagHandles = new HashMap<String, String>();
        while (scanner.checkToken(Token.ID.Directive)) {
            @SuppressWarnings("rawtypes")
            DirectiveToken token = (DirectiveToken) scanner.getToken();
            if (token.getName().equals("YAML")) {
                if (yamlVersion != null) {
                    throw new ParserException(null, null, "found duplicate YAML directive",
                            token.getStartMark());
                }
                List<Integer> value = (List<Integer>) token.getValue();
                Integer major = value.get(0);
                if (major != 1) {
                    throw new ParserException(null, null,
                            "found incompatible YAML document (version 1.* is required)",
                            token.getStartMark());
                }
                Integer minor = value.get(1);
                switch (minor) {
                case 0:
                    yamlVersion = Version.V1_0;
                    break;

                default:
                    yamlVersion = Version.V1_1;
                    break;
                }
            } else if (token.getName().equals("TAG")) {
                List<String> value = (List<String>) token.getValue();
                String handle = value.get(0);
                String prefix = value.get(1);
                if (tagHandles.containsKey(handle)) {
                    throw new ParserException(null, null, "duplicate tag handle " + handle,
                            token.getStartMark());
                }
                tagHandles.put(handle, prefix);
            }
        }
        if (yamlVersion != null || !tagHandles.isEmpty()) {
View Full Code Here

Examples of org.yaml.snakeyaml.tokens.DirectiveToken

            if (ff > 0) {
                reader.forward(ff);
            }
        }
        scanDirectiveIgnoredLine(startMark);
        return new DirectiveToken(name, value, startMark, endMark);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.