Package dtool.sourcegen.AnnotatedSource

Examples of dtool.sourcegen.AnnotatedSource.MetadataEntry


    HashSet<String> expectedResultsDeduplicated = hashSet(expectedResults);
   
    for (String expectedTarget : expectedResultsDeduplicated) {
      if(expectedTarget.startsWith("@") ) {
        String markerName = expectedTarget.substring(1);
        MetadataEntry marker = assertNotNull(markers.get(markerName));
        DefUnitResultsChecker.removeDefUnitByMarker(resultDefUnits, marker);
      } else {
        removeDefUnit(expectedTarget);
      }
    }
View Full Code Here


    testSourceProcessing("#", "> #@{ ►  ►abc\ndef, ,line,\n}==", 10);
   
    // Uniform argument separator syntax -- in metadata
   
    testSourceProcessing("#", "> #MD(►xyz, line\n){ ►ABC,line}==",
      checkMD(">  ►ABC,line==", new MetadataEntry("MD", "►xyz, line\n", " ►ABC,line", 2, true)));
    testSourceProcessing("#", "> #MD:\n►asd, line\n ==",
      checkMD("> ", new MetadataEntry("MD", null, "►asd, line\n ==", 2, false)));
   
   
    // Syntax errors: interactions:
   
    testSourceProcessing("#", "foo #@EXPANSION1{12,}:EXP:", checkMD("foo 12:EXP:"), checkMD("foo :EXP:"));
View Full Code Here

  public void test6_Metadata_Interactions() throws Exception { testMetadata_Interactions$(); }
  public void testMetadata_Interactions$() throws Exception {
    testSourceProcessing("#",
      "asdf #{#}#tag_A(asfd,3,4){xxx},abc###tag_B(arg1,arg2,arg3){sourceValue2}}==#{1,xxx}",
     
      checkMD("asdf }xxx==1", new MetadataEntry("tag_A", "asfd,3,4", "xxx", 6)),
      checkMD("asdf }xxx==xxx", new MetadataEntry("tag_A", "asfd,3,4", "xxx", 6)),
      checkMD("asdf abc#sourceValue2==1", new MetadataEntry("tag_B", "arg1,arg2,arg3", "sourceValue2", 9)),
      checkMD("asdf abc#sourceValue2==xxx", new MetadataEntry("tag_B", "arg1,arg2,arg3", "sourceValue2", 9))
    );
   
    testSourceProcessing("#",
      "#{1,xxx}asdf #{#}#tag_A(asfd,3,4){xxx},###tag_B(arg1,arg2,arg3){sourceValue2}}==",
     
      checkMD("1asdf }xxx==", new MetadataEntry("tag_A", "asfd,3,4", "xxx", 7)),
      checkMD("1asdf #sourceValue2==", new MetadataEntry("tag_B", "arg1,arg2,arg3", "sourceValue2", 7)),
      checkMD("xxxasdf }xxx==", new MetadataEntry("tag_A", "asfd,3,4", "xxx", 9)),
      checkMD("xxxasdf #sourceValue2==", new MetadataEntry("tag_B", "arg1,arg2,arg3", "sourceValue2", 9))
    );
   
    testSourceProcessing("#",
      "foo1 ## #error_EXP(asdf,3,4){xxx}=="+
      "asdf ## #error(info1)=="+
      "#:SPLIT ____\n"+
      "asdf ## #error=="+
      "asdf ## #error{xxx}=="+
      "#:SPLIT ____\n"+
      "multilineMD #error(arg1,arg2,arg3):\n line1\nline2\nline3\n#:END:lineOther4\n",
     
      checkMD(
        "foo1 # xxx=="+
        "asdf # ==",
        new MetadataEntry("error_EXP", "asdf,3,4", "xxx", 7),
        new MetadataEntry("error", "info1", null, 7 +5+7)
      ),
      checkMD(
        "asdf # =="+
        "asdf # xxx==",
        new MetadataEntry("error", null, null, 7),
        new MetadataEntry("error", null, "xxx", 7 +2+7)
      ),
      checkMD(
        "multilineMD lineOther4\n",
        new MetadataEntry("error", "arg1,arg2,arg3", " line1\nline2\nline3\n", 12, false)
      )
    );
   
    // Unnamed definitions in header
    testSourceProcessing("#""#:HEADER ____\n"+"> #@{A,B,C}",
View Full Code Here

  public void testExpansionInMetadata$() throws Exception {
   
    testSourceProcessing("#",
      "> #@EXPANSION1{var1,var2,var3xxx} #tag(arg1,arg2,arg3){mdsource:#@EXPANSION1}",
     
      checkMD("> var1 mdsource:var1", new MetadataEntry("tag", "arg1,arg2,arg3", "mdsource:var1", 7)),
      checkMD("> var2 mdsource:var2", new MetadataEntry("tag", "arg1,arg2,arg3", "mdsource:var2", 7)),
      checkMD("> var3xxx mdsource:var3xxx", new MetadataEntry("tag", "arg1,arg2,arg3", "mdsource:var3xxx", 10))
    );
   
    testSourceProcessing("#",
      "> #tag(arg1){mdsource: #@EXPANSION1{var1,var2,var3xxx} -- #@{A,B,C}(EXPANSION1)}",
     
      checkMD("> mdsource: var1 -- A", new MetadataEntry("tag", "arg1", "mdsource: var1 -- A", 2)),
      checkMD("> mdsource: var2 -- B", new MetadataEntry("tag", "arg1", "mdsource: var2 -- B", 2)),
      checkMD("> mdsource: var3xxx -- C", new MetadataEntry("tag", "arg1", "mdsource: var3xxx -- C", 2))
    );
   
   
    testSourceProcessing("#",
      "> #tag(arg){mdsource: #@EXPANSION1{var1,var2,var3xxx} -- #nestedMD{nestedMDsrc #@{A,B,C}(EXPANSION1)}}",
     
      checkMD("> mdsource: var1 -- nestedMDsrc A",
        new MetadataEntry("tag", "arg", "mdsource: var1 -- nestedMDsrc A", 2),
        new MetadataEntry("nestedMD", null, "nestedMDsrc A", 20)),
      checkMD("> mdsource: var2 -- nestedMDsrc B",
        new MetadataEntry("tag", "arg", "mdsource: var2 -- nestedMDsrc B", 2),
        new MetadataEntry("nestedMD", null, "nestedMDsrc B", 20)),
      checkMD("> mdsource: var3xxx -- nestedMDsrc C",
        new MetadataEntry("tag", "arg", "mdsource: var3xxx -- nestedMDsrc C", 2),
        new MetadataEntry("nestedMD", null, "nestedMDsrc C", 23))
    );
   
    MetadataEntry top;
    testSourceProcessing("#",
      "> #@EXP{AA,B,CCCC} #tag(arg):\ntagMD #nestedMD{xxx}",
     
      checkMD("> AA ",
        top = new MetadataEntry("tag", "arg", "tagMD xxx", 5, false),
        new MetadataEntry("nestedMD", null, "xxx", 6, top))
        ,
      checkMD("> B ",
        top = new MetadataEntry("tag", "arg", "tagMD xxx", 4, false),
        new MetadataEntry("nestedMD", null, "xxx", 6, top))
        ,
      checkMD("> CCCC ",
        top = new MetadataEntry("tag", "arg", "tagMD xxx", 7, false),
        new MetadataEntry("nestedMD", null, "xxx", 6, top)
        )
    );
  }
View Full Code Here

  public void testIfElseExpansion$() throws Exception {
    testSourceProcessing("#",
      "> #@{A,B#var(Bactive)} #?var{THEN}-#?var!{NOT_THEN}",
     
      checkMD("> A -NOT_THEN"),
      checkMD("> B THEN-", new MetadataEntry("var", "Bactive", null, 3))
    );
   
    testSourceProcessing("#",
      "> #@{A,B#var(Bactive)} #?var{THEN,ELSE}-#?var!{NOT_THEN,NOT_ELSE}",
     
      checkMD("> A ELSE-NOT_THEN"),
      checkMD("> B THEN-NOT_ELSE", new MetadataEntry("var", "Bactive", null, 3))
    );
   
    testSourceProcessing("#", "> #?{THEN,ELSE, INVALID}", 4);
    testSourceProcessing("#", "> #@{A ,B #var(Bactive) } #?var{THEN,ELSE, INVALID}", 51);
   
   
    testSourceProcessing("#",
      "#:HEADER ____\n"+"#@EXPANSION1{1#var1,2#var2,3#var3}"+
      "#:SPLIT\n> #?var1{IF,ELSE} #@{A,B,C}(EXPANSION1) -- #@EXPANSION1 "+
      "#?var1{THEN,ELSE}#?var2{var2}",
     
      checkMD("> ELSE A -- 1 THEN", new MetadataEntry("var1", null, null, 13)),
      checkMD("> ELSE B -- 2 ELSEvar2", new MetadataEntry("var2", null, null, 13)),
      checkMD("> ELSE C -- 3 ELSE", new MetadataEntry("var3", null, null, 13))
    );
   
    // Test conditional exp when conditional is inside referred MD
    testSourceProcessing("#",
      "#parentMD【> #@{A,B#var(Bactive)} #?var{IF} #?parentMD{parentMDActive}】",
     
      checkMD("> A  parentMDActive",
        new MetadataEntry("parentMD", null, DONT_CHECK, 0)
      ),
      checkMD("> B IF parentMDActive",
        new MetadataEntry("parentMD", null, DONT_CHECK, 0),
        new MetadataEntry("var", "Bactive", null, 3)
      )
    );
  }
View Full Code Here

        sourceCase.topLevelMDE = mdEndElem.originalTopLevelMDE;
      }
    }
    boolean sourceWasIncluded = mdElem.outputSource;
   
    MetadataEntry mde = new MetadataEntry(mdElem.tag, mdElem.value, associatedSource, offset,
      sourceCase.topLevelMDE, sourceWasIncluded);
    assertTrue(sourceCase.metadata.get(mdEndElem.metadataIx) instanceof TemporaryMetadataEntry);
    sourceCase.metadata.set(mdEndElem.metadataIx, mde);
  }
View Full Code Here

    testSourceProcessing("#",
      splitMarker+" ___________________→◙\ncase1:#NOTMD blah ◙MD"+
      splitMarker+" comment\ncase2:#MD blah ◙NOTMD#:SPLIT comment\r\n"+
      splitMarker+"→X blah\n case#3:\nblahblahXMD\n"
      ,
      checkMD("case1:#NOTMD blah ", new MetadataEntry("MD", null, null, 18)),
      checkMD("case2: blah ◙NOTMD", new MetadataEntry("MD", null, null, 6)),
      checkMD(""),
      checkMD(" case#3:\nblahblah\n", new MetadataEntry("MD", null, null, 17))
    );
  }
View Full Code Here

 
  @Test
  public void testMetadata() throws Exception { testMetadata$(); }
  public void testMetadata$() throws Exception {
    testSourceProcessing("#", "foo1 ## #error_EXP(asfd,3,4){xxx}==",
      checkMD("foo1 # xxx==", new MetadataEntry("error_EXP", "asfd,3,4", "xxx", 7))
    );
   
    testSourceProcessing("#",
      "asdf ## #error(info1)==",
      checkMD("asdf # ==", new MetadataEntry("error", "info1", null, 7))
    );
   
    testSourceProcessing("#",
      "asdf ## #error==",
      checkMD("asdf # ==", new MetadataEntry("error", null, null, 7))
    );
   
    testSourceProcessing("#",
      "asdf ## #error{xxx}==",
      checkMD("asdf # xxx==", new MetadataEntry("error", null, "xxx", 7))
    );
    // Source not included
    testSourceProcessing("#",
      "asdf ## #error¤{xxx}==",
      checkMD("asdf # ==", new MetadataEntry("error", null, "xxx", 7, false))
    );   
    testSourceProcessing("#", "badsyntax #foo()¤", 17);
    testSourceProcessing("#", "badsyntax #fooxx¤", 17);
   
    testSourceProcessing("#",
      "foo1 ## #error_EXP:asfd_ad{xxx}==",
      checkMD("foo1 # xxx==", new MetadataEntry("error_EXP", "asfd_ad", "xxx", 7))
    );
    testSourceProcessing("#",
      "asdf ## #error:info1==",
      checkMD("asdf # ==", new MetadataEntry("error", "info1", null, 7))
    );
   
    // Syntax errors
    testSourceProcessing("#", "badsyntax #foo(=={", 18);
    testSourceProcessing("#", "badsyntax #foo(==){asdf", 18+5);
   
    testSourceProcessing("#", "badsyntax #foo(==#:SPLIT\n)", 17);
    testSourceProcessing("#", "badsyntax #foo(==#:END:", 18);
    testSourceProcessing("#", "badsyntax #foo(){xxx#:SPLIT\n)", 17+3);
    testSourceProcessing("#", "badsyntax #foo(){xxx#:END:", 17+3+2+3);
   
   
    for (int i = 0; i < TemplatedSourceProcessorParser.OPEN_DELIMS.length; i++) {
      String open = TemplatedSourceProcessorParser.OPEN_DELIMS[i];
      String close = TemplatedSourceProcessorParser.CLOSE_DELIMS[i];
      if(open.equals("{"))
        continue;
     
      testSourceProcessing("#", prepString("asdf #foo(arg)►,}◙► #◄,xxx}◄==", open, close),
       
        checkMD(prepString("asdf ,}◙► ◄,xxx}==", open, close),
          new MetadataEntry("foo", "arg", prepString(",}◙► ◄,xxx}", open, close), 5))
      );
    }
   
   
    //multineLine MD syntax
   
    testSourceProcessing("#",
      "multilineMD #error(arg1,arg2,arg3): blah",
     
      checkMD("multilineMD ", new MetadataEntry("error", "arg1,arg2,arg3", " blah", 12, false))
    );
   
    // boundary
    testSourceProcessing("#",
      "multilineMD---#error(arg1,arg2,arg3):\n",
     
      checkMD("multilineMD---", new MetadataEntry("error", "arg1,arg2,arg3", "", 14, false))
    );
   
    // #:END: delim
    testSourceProcessing("#",
      "multilineMD #error(arg1,arg2,arg3):\n line1\nline2\nline3\n#:END:lineOther4\n",
     
      checkMD("multilineMD lineOther4\n",
        new MetadataEntry("error", "arg1,arg2,arg3", " line1\nline2\nline3\n", 12, false))
    );
    testSourceProcessing("#",
      "multilineMD #error(arg1,arg2,arg3):line0\nline1\nline2\nline3#:END:afterEnd\nlineOther4\n",
     
      checkMD("multilineMD afterEnd\nlineOther4\n",
        new MetadataEntry("error", "arg1,arg2,arg3", "line0\nline1\nline2\nline3", 12, false))
    );
   
    // split interaction
    testSourceProcessing("#",
      "multilineMD #error(arg1,arg2,arg3):\n line1\nline2\nline3\n#:SPLIT:\nlineOther4\n",
     
      checkMD("multilineMD ",
        new MetadataEntry("error", "arg1,arg2,arg3", " line1\nline2\nline3\n", 12, false)),
      checkMD("lineOther4\n")
    );
   
    // ► interaction
    testSourceProcessing("#",
      "foo1 ## #MD(ab►c●d)【x►x●x】==",
      checkMD("foo1 # x►x●x==", new MetadataEntry("MD", "ab►c●d", "x►x●x", 7))
    );
   
  }
View Full Code Here

  }
 
  @Test
  public void testNested() throws Exception { testNested$(); }
  public void testNested$() throws Exception {
    MetadataEntry top;
   
    // nested MDs
    testSourceProcessing("#",
      "xxx#multiline1:\n xxxxA\n#multiline2:\n xxB\n#tag(arg1) blah2-cont",
     
      checkMD("xxx",
        top = new MetadataEntry("multiline1", null, " xxxxA\n", 3, false),
        top = new MetadataEntry("multiline2", null, " xxB\n blah2-cont", 7, top, false),
        new MetadataEntry("tag", "arg1", null, 5, top))
    );
   
   
    testSourceProcessing("#",
      "xxxx#TOPA¤【abc#ChildA1【xxx】__#ChildA2¤【zzz】】__#TOPB【abc#ChildB1【xx】__#ChildB2¤【zz】】",
     
      checkMD("xxxx__abcxx__",
        top = new MetadataEntry("TOPA", null, "abcxxx__", 4, null, false),
        new MetadataEntry("ChildA1", null, "xxx", 3, top, true),
        new MetadataEntry("ChildA2", null, "zzz", 3+3+2, top, false),
        new MetadataEntry("TOPB", null, "abcxx__", 4+2, null, true),
        new MetadataEntry("ChildB1", null, "xx", 4+2 + 3, null, true),
        new MetadataEntry("ChildB2", null, "zz", 4+2 + 3+2+2, null, false))
    );
   
    // With expansion
    testSourceProcessing("#",
      "xxxx#TOPA¤【abc#ChildA1【xxx】_#@《A●B》#ChildA2¤【zzz】】--#TOPB¤【topb】",
     
      checkMD("xxxx--",
        top = new MetadataEntry("TOPA", null, "abcxxx_A", 4, null, false),
        new MetadataEntry("ChildA1", null, "xxx", 3, top),
        new MetadataEntry("ChildA2", null, "zzz", 3+3+2, top, false),
        top = new MetadataEntry("TOPB", null, "topb", 6, null, false)
      ),
      checkMD("xxxx--",
        top = new MetadataEntry("TOPA", null, "abcxxx_B", 4, null, false),
        new MetadataEntry("ChildA1", null, "xxx", 3, top, true),
        new MetadataEntry("ChildA2", null, "zzz", 3+3+2, top, false),
        top = new MetadataEntry("TOPB", null, "topb", 6, null, false)
      )
    );
   
    // All together
    testSourceProcessing("#",
      "foo1 ## #error_EXP(asdf,3,4){xxx}=="+
      "asdf ## #error(info1)=="+
      "asdf ## #error=="+
      "asdf ## #error{xxx}=="+
      "multilineMD #error(arg1,2,a3):\n line1\nline2#tagInMD(blah){xxx}\nline3\n#:END:lineOther4\n",
     
      checkMD(
        "foo1 # xxx=="+
        "asdf # =="+
        "asdf # =="+
        "asdf # xxx=="+
        "multilineMD lineOther4\n",
        new MetadataEntry("error_EXP", "asdf,3,4", "xxx", 7),
        new MetadataEntry("error", "info1", null, 7 +5+7),
        new MetadataEntry("error", null, null, 7 +5+7 +2+7),
        new MetadataEntry("error", null, "xxx", 7 +5+7 +2+7 +2+7),
        top = new MetadataEntry("error", "arg1,2,a3", " line1\nline2xxx\nline3\n",
          7 +5+7 +2+7 +2+7 +3+2+12, false),
        new MetadataEntry("tagInMD", "blah", "xxx", 12, top)
      )
    );
   
  }
View Full Code Here

      ParametersReparseCheck.ambigParameterReparseTest(nodeSource);       
    }
  }
 
  public void runDDocTest(final DeeParserResult result) {
    MetadataEntry targetMDE = removeTestMetadata("DDOC_TEST_TARGET");
    if(targetMDE == null) {
      return;
    }
   
    DefUnit defUnit = findDDocTargetDefUnit(result, targetMDE);
View Full Code Here

TOP

Related Classes of dtool.sourcegen.AnnotatedSource.MetadataEntry

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.