Package dk.brics.xact.analysis.flowgraph

Examples of dk.brics.xact.analysis.flowgraph.TemplateConstant


                if (s.getSchema() != null)
                    linkSchemaType(s, s.getSchema());
            }
            @Override
            public void visitConstStm(ConstStm s) {
                TemplateConstant t = s.getConst();
                if (t.getFragment() != null)
                    return;
                // handle empty XML specially to avoid "" text nodes
                if (t.getXML().isText() && t.getXML().asText().getString().isEmpty()) {
                    SequenceNode n = new SequenceNode(Collections.<Integer>emptyList(), s.getOrigin());
                    xg.addNode(n);
                    XMLGraphFragment f = new XMLGraphFragment(n, null, null, null);
                    t.setFragment(f);
                } else {
                    XMLGraphFragment f = XMLGraphConverter.extend(xg, t.getXML(), XMLGraphConverter.GapConversion.CLOSED, true);
                    for (Map.Entry<String,String> en : f.getGapTypeMap().entrySet()) {
                        String gaptype = en.getValue();
                        // add gap types to the xml graph, and ensure that they are valid
                        resolveTypename(gaptype);
                    }
                    t.setFragment(f);
                }
            }
            void linkSchemaType(Statement s, SchemaType type) {
                type.setTypeNode(resolveTypename(type.getType()));
                for (Map.Entry<String,String> gap : type.getGapTypes().entrySet()) {
View Full Code Here


                if (s.getSchema() != null)
                    linkSchemaType(s, s.getSchema());
            }
            @Override
            public void visitConstStm(ConstStm s) {
                TemplateConstant t = s.getConst();
                if (t.getFragment() != null)
                    return;
                // handle empty XML specially to avoid "" text nodes
                if (t.getXML().isText() && t.getXML().asText().getString().isEmpty()) {
                    SequenceNode n = new SequenceNode(Collections.<Integer>emptyList(), s.getOrigin());
                    xg.addNode(n);
                    XMLGraphFragment f = new XMLGraphFragment(n, null, null, null);
                    t.setFragment(f);
                } else {
                    XMLGraphFragment f = XMLGraphConverter.extend(xg, t.getXML(), XMLGraphConverter.GapConversion.CLOSED, true);
                    for (Map.Entry<String,String> en : f.getGapTypeMap().entrySet()) {
                        String gaptype = en.getValue();
                        // add gap types to the xml graph, and ensure that they are valid
                        resolveTypename(gaptype);
                    }
                    t.setFragment(f);
                }
            }
View Full Code Here

  }
  @Override
  public Variable caseNullConstant(NullConstant v, Object question) {
    Variable dest = makevar();
    //cfg.addStatement(new EmptyStm(dest, false, context.getCurrentOrigin()));
    TemplateConstant cnst = new TemplateConstant("", new HashMap<String,String>(), context.getCurrentOrigin());
    cnst.setXML(parseXML(cnst.getTemplate(), context.getCurrentOrigin()));
    cfg.addStatement(new ConstStm(dest, cnst, context.getCurrentOrigin()));
    return dest;
  }
View Full Code Here

  /**
   * Generates a ConstStm.
   */
  private void putConst(String template, Origin origin) {
    hardcodeResult = makevar();
    TemplateConstant cnst = new TemplateConstant(template, context.getNamespaces(), origin);
    XML x = parseXML(cnst.getTemplate(), origin);
    if (x != null) {
        cnst.setXML(x);
        cfg.addStatement(new ConstStm(hardcodeResult,
            cnst,
            origin));
    } else {
        // error recovery: just let result be undefined (ie bottom)
View Full Code Here

          stm_nodes.setConcatSequenceNode(s, sn);
        }
       
        @Override
        public void visitConstStm(ConstStm s) {
          TemplateConstant t = s.getConst();
          try {
            stm_nodes.setTemplateConstantXMLFragment(t, t.getFragment());
          } catch (XMLTemplateException e) {
            Throwable tr = e;
            if (tr.getCause() != null)
              tr = tr.getCause();
            String msg = tr.getMessage();
View Full Code Here

TOP

Related Classes of dk.brics.xact.analysis.flowgraph.TemplateConstant

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.