private void expectAlias() throws IOException { if (((NodeEvent) event).getAnchor() == null) { throw new EmitterException("没有为锚点对象指定别名"); } processAnchor("*"); state = states.pop(); }
private boolean checkSimpleKey() { int length = 0; if (event instanceof NodeEvent && ((NodeEvent) event).getAnchor() != null) { if (preparedAnchor == null) { preparedAnchor = prepareAnchor(((NodeEvent) event).getAnchor()); } length += preparedAnchor.length(); } String tag = null; if (event instanceof ScalarEvent) { tag = ((ScalarEvent) event).getTag(); } else if (event instanceof CollectionStartEvent) { tag = ((CollectionStartEvent) event).getTag(); } if (tag != null) { if (preparedTag == null) { preparedTag = prepareTag(tag); } length += preparedTag.length(); } if (event instanceof ScalarEvent) { if (analysis == null) { analysis = analyzeScalar(((ScalarEvent) event).getValue()); } length += analysis.scalar.length(); } return length < 128 && (event instanceof AliasEvent || (event instanceof ScalarEvent && !analysis.empty && !analysis.multiline) || checkEmptySequence() || checkEmptyMapping()); }
private void processAnchor(String indicator) throws IOException { NodeEvent ev = (NodeEvent) event; if (ev.getAnchor() == null) { preparedAnchor = null; return; } if (preparedAnchor == null) { preparedAnchor = prepareAnchor(ev.getAnchor()); } writeIndicator(indicator + preparedAnchor, true, false, false); preparedAnchor = null; }
private void expectAlias() throws IOException { if (((NodeEvent) event).getAnchor() == null) { throw new EmitterException("anchor is not specified for alias"); } processAnchor("*"); state = states.pop(); }
boolean checkSimpleKey() { int length = 0; if ((this.event instanceof NodeEvent) && (((NodeEvent) this.event).getAnchor() != null)) { if (this.preparedAnchor == null) { this.preparedAnchor = prepareAnchor(((NodeEvent) this.event).getAnchor()); } length += this.preparedAnchor.length(); } String tag = null; if (this.event instanceof ScalarEvent) { tag = ((ScalarEvent) this.event).getTag(); } else if (this.event instanceof CollectionStartEvent) { tag = ((CollectionStartEvent) this.event).getTag(); } if (tag != null) { if (this.preparedTag == null) { this.preparedTag = this.prepareTag(tag); } length += this.preparedTag.length(); } if (this.event instanceof ScalarEvent) { if (this.analysis == null) { this.analysis = this.analyzeScalar(((ScalarEvent) this.event).getValue()); } length += this.analysis.scalar.length(); } return (length < SMALL_LENGTH) && ((this.event instanceof AliasEvent) || ((this.event instanceof ScalarEvent) && ! ((this.analysis == null) || this.analysis.empty) && ! this.analysis.multiline) || this.checkEmptySequence() || this.checkEmptyMapping()); }
private boolean checkSimpleKey() { int length = 0; if (event instanceof NodeEvent && ((NodeEvent) event).getAnchor() != null) { if (preparedAnchor == null) { preparedAnchor = prepareAnchor(((NodeEvent) event).getAnchor()); } length += preparedAnchor.length(); } String tag = null; if (event instanceof ScalarEvent) { tag = ((ScalarEvent) event).getTag(); } else if (event instanceof CollectionStartEvent) { tag = ((CollectionStartEvent) event).getTag(); } if (tag != null) { if (preparedTag == null) { preparedTag = prepareTag(tag); } length += preparedTag.length(); } if (event instanceof ScalarEvent) { if (analysis == null) { analysis = analyzeScalar(((ScalarEvent) event).getValue()); } length += analysis.scalar.length(); } return (length < 128 && (event instanceof AliasEvent || (event instanceof ScalarEvent && !analysis.empty && !analysis.multiline) || checkEmptySequence() || checkEmptyMapping())); }