Merge MVP features #1

Merged
dominic merged 16 commits from prototype into master 2026-04-24 18:48:16 +00:00
Showing only changes of commit c93864c7e4 - Show all commits

View File

@ -188,11 +188,10 @@ namespace XNeedle.Parser
public static CommentParser Comment = new CommentParser { Single = "#", NewLine = Environment.NewLine };
public static readonly Parser<Part> BangObject =
public static readonly Parser<Part> BangObject =
from c1 in Comment.SingleLineComment.Optional()
from bang in Parse.Char('!')
from name in Parse.AnyChar.Until(Parse.Char('('))
from bopen in Parse.Char('(')
from arguments in Argument.DelimitedBy(Parse.Char(',').Token())
from bclose in Parse.Char(')')
let ctx = new Context{XPathSelector = "//*."}
@ -200,7 +199,10 @@ namespace XNeedle.Parser
from open in Parse.Char('{')
from ws2 in Parse.WhiteSpace.Many().Optional()
from c2 in Comment.SingleLineComment.Optional()
from expressions in ExprPart(ctx).Or<Part>(Parse.Ref(() => RuleObject)).Or<Part>(Parse.Ref(() => BangObject)).DelimitedBy(Parse.Char(';').Token())
from expressions in Parse.Ref(() => BangObject)
.Or(Parse.Ref(() => RuleObject))
.Or(ExprPart(ctx).Select(e => (Part)e))
.DelimitedBy(Parse.Char(';').Token())
from tailingsemi in Parse.Char(';').Optional()
from ws3 in Parse.WhiteSpace.Many().Optional()
from close in Parse.Char('}')
@ -214,10 +216,14 @@ namespace XNeedle.Parser
from open in Parse.Char('{')
from ws2 in Parse.WhiteSpace.Many().Optional()
from c2 in Comment.SingleLineComment.Optional()
from expressions in ExprPart(ctx).Or<Part>(Parse.Ref(() => RuleObject)).Or<Part>(Parse.Ref(() => BangObject)).DelimitedBy(Parse.Char(';').Token())
from expressions in Parse.Ref(() => BangObject)
.Or(Parse.Ref(() => RuleObject))
.Or(ExprPart(ctx).Select(e => (Part)e))
.DelimitedBy(Parse.Char(';').Token())
from tailingsemi in Parse.Char(';').Optional()
from ws3 in Parse.WhiteSpace.Many().Optional()
from close in Parse.Char('}')
select new Rule{XPathSelector = selector, Body = expressions};
}
}