static void Main(string[] args) { string code = @" ' comment 1 rem comment 2 option explicit sub s(k) with wscript ' comment 3 .echo k end with end sub dim a, b(3), i a = 234 & ""test"" s a for i = lbound(b) to ubound(b) b(i) = i * 2 call s(b(i)) next "; var parser = new VBScriptParser(code, new ParsingOptions { SaveComments = true }); var program = parser.Parse(); }
public void Parse_OptionExplicitString_ReturnsAstWithEmptyBody(string code) { var prg = new VBScriptParser(code).Parse(); Assert.NotNull(prg); Assert.True(prg.OptionExplicit); Assert.Empty(prg.Comments); Assert.Empty(prg.Body); Assert.Equal(0, prg.Range.Start); }
public void Parse_EmptyStringWithComments_ReturnsEmptyAstWithComments(string code) { var prg = new VBScriptParser(code, new ParsingOptions { SaveComments = true }).Parse(); Assert.NotNull(prg); Assert.False(prg.OptionExplicit); Assert.Single(prg.Comments); Assert.Empty(prg.Body); Assert.Equal(0, prg.Range.Start); }