Example #1
0
 protected LNode KeywordExpr(LNode node)
 {
     return(node.SetBaseStyle(NodeStyle.Special));
 }
Example #2
0
 // This is virtual so that a syntax highlighter can easily override and colorize it
 protected virtual LNode MarkCall(LNode n)
 {
     return(n.SetBaseStyle(NodeStyle.PrefixNotation));
 }
Example #3
0
 protected LNode Op(LNode node)
 {
     return(node.SetBaseStyle(NodeStyle.Operator));
 }
		protected LNode KeywordExpr(LNode node)
		{
			return node.SetBaseStyle(NodeStyle.Special);
		}
Example #5
0
 // This is virtual so that a syntax highlighter can easily override and colorize it
 protected virtual LNode MarkSpecial(LNode n)
 {
     return(n.SetBaseStyle(NodeStyle.Special));
 }
Example #6
0
		LNode SetOperatorStyle(LNode node)
		{
			return node.SetBaseStyle(NodeStyle.Operator);
		}
		protected LNode Op(LNode node)
		{
			return node.SetBaseStyle(NodeStyle.Operator);
		}
Example #8
0
 static LNode Operator(LNode node)
 {
     return(node.SetBaseStyle(NodeStyle.Operator));
 }
Example #9
0
 static LNode AsStyle(NodeStyle s, LNode node)
 {
     return(node.SetBaseStyle(s));
 }
		static LNode Operator(LNode node) { return node.SetBaseStyle(NodeStyle.Operator); }
		static LNode AsStyle(NodeStyle s, LNode node) { return node.SetBaseStyle(s); }
Example #12
0
        public static LNode Prop(LNode node, IMacroContext context)
        {
            LNode visibility = node.Target;

            if (visibility.Name != sy__numprop)
            {
                node = node.PlusAttr(visibility);
            }

            {
                LNode     getExpr, init = null, name, tmp_12 = null, tmp_13 = null, tmp_14, tmp_15, type;
                LNodeList content;
                if (node.Args.Count == 2 && (tmp_12 = node.Args[0]) != null && tmp_12.Calls(CodeSymbols.Colon, 2) && (name = tmp_12.Args[0]) != null && (type = tmp_12.Args[1]) != null && node.Args[1].Calls(CodeSymbols.Braces) && (content = node.Args[1].Args).IsEmpty | true || node.Args.Count == 3 && (tmp_13 = node.Args[0]) != null && tmp_13.Calls(CodeSymbols.Colon, 2) && (name = tmp_13.Args[0]) != null && (type = tmp_13.Args[1]) != null && node.Args[1].Calls(CodeSymbols.Braces) && (content = node.Args[1].Args).IsEmpty | true && node.Args[2].Calls((Symbol)"#initially", 1) && (init = node.Args[2].Args[0]) != null)
                {
                    LNode args    = GetArgList(ref name);
                    var   newBody = LNode.List();
                    foreach (var part_ in content)
                    {
                        LNode part = part_;
                        {
                            LNode body, value;
                            if (part.Calls((Symbol)"#get", 0))
                            {
                                part = LNode.Id(S.get, part);
                            }
                            else if (part.Calls((Symbol)"#get", 1) && (body = part.Args[0]) != null)
                            {
                                part = part.WithName(S.get);
                                if (body.Calls(S.Braces))
                                {
                                    part = part.SetBaseStyle(NodeStyle.Special);
                                }
                                else
                                {
                                    part = part.With(S.Lambda, part.Target, body);
                                }
                            }
                            else if (part.Calls((Symbol)"#set", 0))
                            {
                                part = LNode.Id(S.set, part);
                            }
                            else if (part.Calls((Symbol)"#set", 1) && (body = part.Args[0]) != null)
                            {
                                part = part.WithName(S.set);
                                if (body.Calls(S.Braces))
                                {
                                    part = part.SetBaseStyle(NodeStyle.Special);
                                }
                                else
                                {
                                    part = part.With(S.Lambda, part.Target, body);
                                }
                            }
                            else if (part.Calls((Symbol)"#init", 1) && (value = part.Args[0]) != null)
                            {
                                init = value;
                                part = null;
                            }
                        }
                        if (part != null)
                        {
                            newBody.Add(part);
                        }
                    }
                    if (init != null)
                    {
                        if (newBody.IsEmpty)
                        {
                            newBody.Add(F.Id(S.get));
                        }
                        return(node.With(S.Property, type, name, args, F.Braces(newBody), init));
                    }
                    else
                    {
                        return(node.With(S.Property, type, name, args, F.Braces(newBody)));
                    }
                }
                else if (node.Args.Count == 1 && (tmp_14 = node.Args[0]) != null && tmp_14.Calls(CodeSymbols.Colon, 2) && (name = tmp_14.Args[0]) != null && (tmp_15 = tmp_14.Args[1]) != null && tmp_15.Calls(CodeSymbols.Lambda, 2) && (type = tmp_15.Args[0]) != null && (getExpr = tmp_15.Args[1]) != null)
                {
                    var args = GetArgList(ref name);
                    return(node.With(S.Property, type, name, args, getExpr));
                }
            }
            return(Les2.Reject(context, node, "Unrecognized property syntax"));

            LNode GetArgList(ref LNode name_apos)
            {
                if (name_apos.Calls(S.IndexBracks))
                {
                    var args = name_apos.Args.RemoveAt(0);
                    name_apos = name_apos[0].PlusAttrs(name_apos.Attrs);
                    return(F.Call(S.AltList, args));
                }
                else
                {
                    return(LNode.Missing);
                }
            }
        }