Package dk.brics.xact.analysis.flowgraph

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


          // be visible.
          methodentry = methodexit = null;
          returnVar = null;
        }
        // parse annotations
        SchemaType returnType;
        if (context.isAnnotatableType(m.getReturnType())) {
          returnType = context.parseSchemaType(config.getMethodReturnType(m, context.getTypeAnnotation(m)), origin);
        } else {
          returnType = null;
        }
View Full Code Here


      return null;
   
    XMLAnalysisException ex = new XMLAnalysisException("Malformed @Type argument '" + annotation + "'", getCurrentOrigin());
    annotation = annotation.trim();
    // make schema
    SchemaType schema;
    int leftbrack = annotation.indexOf('[');
    int rightbrack = annotation.lastIndexOf(']');
    if (leftbrack<0 != rightbrack<0)
      throw ex;
    if (leftbrack<0 || rightbrack<0) {
      // no gap annotations
      schema = new SchemaType(expandQName(annotation), origin);
    } else {
      // parse gap annotations
      String start = annotation.substring(0, leftbrack).trim();
      String gaps = annotation.substring(leftbrack+1, rightbrack).trim();
      String[] ga = gaps.split(",");
      if (ga.length==0)
        ga = new String[]{ gaps };
      // build gap info
      Collection<String> tgaps = new LinkedHashSet<String>();
      Collection<String> agaps = new LinkedHashSet<String>();
      Map<String,String> gap_types = new LinkedHashMap<String,String>();
      for (String g : ga) {
        g = g.trim();
        int space = g.indexOf(' ');
        if (space<0)
          throw ex;
        String gaptype = g.substring(0, space).trim();
        String gapname = g.substring(space+1).trim();
        Collection<String> set;
        if (gapname.startsWith("@")) { // attribute gap?
          gapname = gapname.substring(1);
          set = agaps;
        } else
          set = tgaps;
        set.add(gapname);
        gap_types.put(gapname, gaptype);
      }
      schema = new SchemaType(expandQName(start), tgaps, agaps, expandQNames(gap_types), origin);
    }
    return schema;
  }
View Full Code Here

  /**
   * Generates a GapifyStm.
   */
  private void putGapify(Value base, Value xpath, Value gap, Value type) {
    SchemaType schema;
    if (type != null) {
      schema = context.parseSchemaType(context.getConstantString(type), context.getCurrentOrigin());
    } else {
      schema = null;
    }
View Full Code Here

  /**
   * Generates an AnalyzeStm.
   */
  private void putAnalyze(Value base, Value type) {
    SchemaType schema = context.parseSchemaType(context.getConstantString(type), context.getCurrentOrigin());
    cfg.addStatement(new AnalyzeStm(AnalyzeStm.Kind.ANALYZECALL, hardcodeResult = makevar(), translateExpr(base),
        schema,
        context.getCurrentOrigin()));
  }
View Full Code Here

  /**
   * Generates an ValidateStm.
   */
  private void putValidate(Value base, Value type) {
    SchemaType schema = context.parseSchemaType(context.getConstantString(type), context.getCurrentOrigin());
    cfg.addStatement(new ValidateStm(hardcodeResult = makevar(), translateExpr(base),
        schema,
        context.getCurrentOrigin()));
  }
View Full Code Here

                        formatExample(example));
                return true;
              }
            });
            XMLGraph type_xg = b.getGlobalXMLGraph().clone();
            SchemaType schema = s.getSchema();
            String type = schema.getType();
            Node n = fg.getTypemap().get(type);
            if (n == null)
              throw new XMLAnalysisException("No schema definition found for " + type, s.getOrigin());
            type_xg.useFragment(new XMLGraphFragment(n, null, null, null));
            Map<String,String> gaptypes = schema.getGapTypes();
            if (gaptypes == null)
                gaptypes = Collections.emptyMap();
            for (Map.Entry<String,String> valueGapType : value_xg.getGapTypeMap().entrySet()) {
                String typeGapType = gaptypes.get(valueGapType.getKey());
                if (!valueGapType.getValue().equals(typeGapType)) {
View Full Code Here

    g.setUnknown(); // TODO: use an ordinary 'any' schema instead?
    return g;
  }

  public XMLGraph transferValidate(final ValidateStm s, XMLGraph base) {
    final SchemaType schema = s.getSchema();
    final XMLGraph g = global_xg.clone();
    g.useFragment(new XMLGraphFragment(schema.getTypeNode(), schema.getTemplateGaps(), schema.getAttributeGaps(), schema.getGapTypes()));
    g.sharpen();
    return g;
  }
View Full Code Here

TOP

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

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.