Examples of ATGSegment


Examples of at.ssw.coco.lib.model.atgmodel.ATGSegment

    }
  }
 
  void Coco() {
    int beg, end;
    ATGSegment imports=null, ignores=null, comments=null;
    ATGSegment settings, productions;
    ATGSegment group, child;
    String str0, attribs;
   
    if (StartOf(1)) {
      Get();
      beg = t.pos;
      while (StartOf(1)) {
        Get();
      }
      imports = new ATGSegment(SECTION_IMPORTS, beg, la.pos-1);
    }
    Expect(6);
    beg = t.pos;
    Expect(1);
    fRoot = new ATGSegment(SECTION_COMPILER, t.val, beg);
    settings = new ATGSegment(SECTION_SCANNER);
    if (imports != null) fRoot.addChild(imports);
    beg = end = la.pos;
   
    while (StartOf(2)) {
      Get();
      end = t.pos + t.val.length();
    }
    if (end > beg) fRoot.addChild(new ATGSegment(SECTION_CODE, beg, end));
    if (la.kind == 7) {
      Get();
      settings.addChild(new ATGSegment(GROUP_IGNORECASE, t.pos, t.pos + t.val.length()));
    }
    if (la.kind == 8) {
      Get();
      group = new ATGSegment(GROUP_CHARACTERS, t.pos);
      while (la.kind == 1) {
        SetDecl(group);
      }
      group.setEndPoint(t.pos + t.val.length()); settings.addChild(group);
    }
    if (la.kind == 9) {
      Get();
      group = new ATGSegment(GROUP_TOKENS, t.pos);
      while (la.kind == 1 || la.kind == 3 || la.kind == 5) {
        TokenDecl(group);
      }
      group.setEndPoint(t.pos + t.val.length()); settings.addChild(group);
    }
    if (la.kind == 10) {
      Get();
      group = new ATGSegment(GROUP_PRAGMAS, t.pos);
      while (la.kind == 1 || la.kind == 3 || la.kind == 5) {
        TokenDecl(group);
      }
      group.setEndPoint(t.pos + t.val.length()); settings.addChild(group);
    }
    while (la.kind == 11) {
      Get();
      beg = t.pos;
      if (comments == null) comments = new ATGSegment(GROUP_COMMENTS, beg);
      Expect(12);
      TokenExpr();
      str0 = "FROM " + t.val +" TO ";
      Expect(13);
      TokenExpr();
      str0 += t.val;
      if (la.kind == 14) {
        Get();
        str0 += " (NESTED)";
      }
      comments.addChild(new ATGSegment(ITEM_COMMENT, str0, beg, t.pos + t.val.length()));
      comments.setEndPoint(t.pos + t.val.length());
    }
    if (comments!=null) settings.addChild(comments);
    while (la.kind == 15) {
      Get();
      beg = t.pos;
      if (ignores==null) ignores = new ATGSegment(GROUP_IGNORE, t.pos);
      str0 = Set();
      ignores.setEndPoint(t.pos + t.val.length());
      ignores.addChild(new ATGSegment(ITEM_IGNORE, str0, beg, t.pos + t.val.length()));
    }
    if (ignores!=null) settings.addChild(ignores);
    settings.setEndPoint(t.pos + t.val.length());
    while (!(la.kind == 0 || la.kind == 16)) {SynErr(45); Get();}
    Expect(16);
    fRoot.addChild(settings);
    productions = new ATGSegment(SECTION_PRODUCTIONS, t.pos);
    fRoot.addChild(productions);
   
    while (la.kind == 1) {
      Get();
      beg = t.pos; str0 = t.val; attribs = null;
      if (la.kind == 24 || la.kind == 29) {
        attribs = AttrDecl();
        attribs = "<" + attribs + ">";
      }
      if (la.kind == 42) {
        SemText();
      }
      ExpectWeak(17, 3);
      Expression();
      ExpectWeak(18, 4);
      child = new ATGSegment(ITEM_PRODUCTION, str0, beg, t.pos + t.val.length());
      if (attribs != null) child.setAttributes(attribs);
      productions.addChild(child);
     
    }
    productions.setEndPoint(t.pos + t.val.length());
View Full Code Here

Examples of at.ssw.coco.lib.model.atgmodel.ATGSegment

    Expect(18);
    fRoot.setEndPoint(t.pos);
  }

  void SetDecl(ATGSegment parent) {
    ATGSegment child; String s = null; assert s == null;
    Expect(1);
    child = new ATGSegment(ITEM_CHARSET, t.val, t.pos);
    Expect(17);
    s = Set();
    child.setEndPoint(t.pos + t.val.length()); parent.addChild(child);
    Expect(18);
  }
View Full Code Here

Examples of at.ssw.coco.lib.model.atgmodel.ATGSegment

    child.setEndPoint(t.pos + t.val.length()); parent.addChild(child);
    Expect(18);
  }

  void TokenDecl(ATGSegment parent) {
    ATGSegment child;
    Sym();
    child = new ATGSegment(ITEM_TOKEN, t.val, t.pos);
    while (!(StartOf(5))) {SynErr(46); Get();}
    if (la.kind == 17) {
      Get();
      TokenExpr();
      Expect(18);
    } else if (StartOf(6)) {
    } else SynErr(47);
    if (la.kind == 42) {
      SemText();
    }
    child.setEndPoint(t.pos + t.val.length()); parent.addChild(child);
  }
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.