public Class(IOpenBraceStatement OpenBraceStatementBase, ILine Line, ILiveStatement LiveStatementBase, System.Boolean Public = false, System.Collections.Generic.List<System.String> Implements = null, System.String Name = null)
 {
     this.OpenBraceStatementBase = OpenBraceStatementBase;
     this.Public = Public;
     this.Line = Line;
     this.LiveStatementBase = LiveStatementBase;
     this.Implements = Implements;
     this.Name = Name;
 }
예제 #2
0
 public static Parameter ToParameter(this String arg, ILiveStatement statement)
 {
     string defVal = arg.Contains("=") ? arg.SubstringAfter("=").Trim() : null;
     string type = null;
     string paramName = arg.SubstringBefore(':', '=').Trim();
     if (!arg.Contains(":"))
     {
         #region insist that default value is specified and simple
         if (string.IsNullOrEmpty(defVal))
         {
             throw new Exception("Error in " + statement.LineNumber + " : no type specified, no default value");
         }
         switch (defVal)
         {
             case "null":
                 throw new Exception("Error in " + statement.LineNumber + " : no type specified, unable to determine type from default value");
             case "true":
             case "false":
                 type = "bool";
                 break;
         }
         if (type == null)
         {
             if (defVal.StartsWith("\"") && defVal.EndsWith("\""))
             {
                 type = "string";
             }
             else
             {
                 float f = 0;
                 bool isFloat = float.TryParse(defVal, out f);
                 if (isFloat)
                 {
                     type = "number";
                 }
                 else
                 {
                     throw new Exception("Error in " + statement.LineNumber + " : no type specified, unable to determine type from default value");
                 }
             }
         }
         #endregion
     }
     else
     {
         type = arg.SubstringAfter(":").TrimStart().SubstringBefore(' ', '=').TrimStart();
     }
     var p = new Parameter
     {
         Name = paramName,
         InitialValue = defVal,
         Type = type
     };
     return p;
 }
예제 #3
0
파일: Parser.cs 프로젝트: bahrus/teaspoon
 public OpenParenOpenBracketStatement(ILiveStatement liveStatement)
 {
     this.LiveStatementBase = liveStatement;
     this.Line = liveStatement.Line;
 }
 public VariableOBS(IOpenBraceStatement OpenBraceStatementBase, ILine Line, ILiveStatement LiveStatementBase, System.Collections.Generic.List<IParameter> Parameters = null)
 {
     this.OpenBraceStatementBase = OpenBraceStatementBase;
     this.Line = Line;
     this.LiveStatementBase = LiveStatementBase;
     this.Parameters = Parameters;
 }
 public Variable(ILine Line, ILiveStatement LiveStatementBase)
 {
     this.Line = Line;
     this.LiveStatementBase = LiveStatementBase;
 }
 public StaticInterfaceMethod(IOpenBraceStatement OpenBraceStatementBase, ILine Line, ILiveStatement LiveStatementBase, System.String Name = null, System.Collections.Generic.List<ILiveStatement> Parameters = null, System.String ReturnType = null)
 {
     this.OpenBraceStatementBase = OpenBraceStatementBase;
     this.Line = Line;
     this.LiveStatementBase = LiveStatementBase;
     this.Name = Name;
     this.Parameters = Parameters;
     this.ReturnType = ReturnType;
 }
 public StaticFunction(IOpenBraceStatement OpenBraceStatementBase, ILine Line, ILiveStatement LiveStatementBase, System.Boolean Public = false, System.String Name = null, System.Collections.Generic.List<IParameter> Args = null, System.String ReturnType = null)
 {
     this.OpenBraceStatementBase = OpenBraceStatementBase;
     this.Line = Line;
     this.LiveStatementBase = LiveStatementBase;
     this.Public = Public;
     this.Name = Name;
     this.Args = Args;
     this.ReturnType = ReturnType;
 }
 public OpenBraceStatement(ILine Line, ILiveStatement LiveStatementBase, System.Collections.Generic.List<ILine> Children = null, System.String ClosingLineComment = null, System.String OptionalLineSeparator = null, System.String ClosingLine = null)
 {
     this.Line = Line;
     this.Children = Children;
     this.ClosingLineComment = ClosingLineComment;
     this.OptionalLineSeparator = OptionalLineSeparator;
     this.ClosingLine = ClosingLine;
     this.LiveStatementBase = LiveStatementBase;
 }
 public Module(IOpenBraceStatement OpenBraceStatementBase, ILine Line, ILiveStatement LiveStatementBase, System.String FullName = null)
 {
     this.OpenBraceStatementBase = OpenBraceStatementBase;
     this.Line = Line;
     this.LiveStatementBase = LiveStatementBase;
     this.FullName = FullName;
 }
 public Interface(IOpenBraceStatement OpenBraceStatementBase, ILine Line, ILiveStatement LiveStatementBase, System.String HelpText = null, System.Boolean Public = false, System.Collections.Generic.List<System.String> Extends = null, System.String Name = null, System.Collections.Generic.List<IField> Fields = null)
 {
     this.HelpText = HelpText;
     this.OpenBraceStatementBase = OpenBraceStatementBase;
     this.Public = Public;
     this.Line = Line;
     this.LiveStatementBase = LiveStatementBase;
     this.Extends = Extends;
     this.Name = Name;
     this.Fields = Fields;
 }