Inheritance: System.Enum, System.IComparable, System.IFormattable, System.IConvertible
コード例 #1
1
 /// <summary>
 /// Initializes a new isntance of the <see cref="RegexLexerContext"/> class
 /// </summary>
 /// <param name="position">the position into the source file</param>
 /// <param name="match">the regular expression match data</param>
 /// <param name="stateStack">The stack of states</param>
 /// <param name="ruleTokenType">The token type the rule specified to emit</param>
 public RegexLexerContext(int position, Match match, Stack<string> stateStack, TokenType ruleTokenType)
 {
     Position = position;
     Match = match;
     StateStack = stateStack;
     RuleTokenType = ruleTokenType;
 }
コード例 #2
0
ファイル: Util.cs プロジェクト: oguna/AssimpSharp
        private static string TokenTypeString(TokenType t)
        {
            switch (t)
            {
                case TokenType.OpenBracket:
                    return "TOK_OPEN_BRACKET";

                case TokenType.CloseBracket:
                    return "TOK_CLOSE_BRACKET";

                case TokenType.Data:
                    return "TOK_DATA";

                case TokenType.Comma:
                    return "TOK_COMMA";

                case TokenType.Key:
                    return "TOK_KEY";

                case TokenType.BinaryData:
                    return "TOK_BINARY_DATA";
            }
            Debug.Assert(false);
            return "";
        }
コード例 #3
0
ファイル: Tokenizer.cs プロジェクト: etinquis/nexusmodmanager
		public Token(TokenType type, string ltoken, string token)
		{
			this.type = type;
			this.utoken = token;
			this.token = ltoken;
			this.keyword = Keywords.NotAKeyword;
		}
コード例 #4
0
ファイル: ParseUtils.cs プロジェクト: thomasvt/EffectEd
        /// <summary>
        /// Splits tokenchain into separated tokens with a given separator token type.
        /// Also ignores subcodeblocks delimited by (, [ or {.
        /// </summary>
        /// <param name="tokens"></param>
        /// <param name="index"></param>
        /// <param name="length"></param>
        /// <param name="splitter"></param>
        /// <returns></returns>
        public static List<List<Token>> SplitTokenChain(Token[] tokens, int index, int length, TokenType splitter)
        {
            var round = 0;
            var square = 0;
            var curly = 0;
            var listList = new List<List<Token>>();
            var list = new List<Token>();
            for (var i = index; i < index + length; i++)
            {
                var token = tokens[i];
                if (token.Type == TokenType.RoundOpen) round++;
                if (token.Type == TokenType.SquareOpen) square++;
                if (token.Type == TokenType.CurlyOpen) curly++;
                if (token.Type == TokenType.RoundClose) round--;
                if (token.Type == TokenType.SquareClose) square--;
                if (token.Type == TokenType.CurlyClose) curly--;

                if (round <= 0 && square <= 0 && curly <= 0 && token.Type == splitter)
                {
                    listList.Add(new List<Token>() { token}); // add splitters too
                    listList.Add(list);
                    list = new List<Token>();
                }
                else
                {
                    list.Add(token);
                }
            }
            listList.Add(list); // add last part, only if at least one separator is detected
            return listList;
        }
コード例 #5
0
ファイル: vxsqltokenizer.cs プロジェクト: apenwarr/versaplex
    public VxSqlToken(TokenType t, string n, string l)
    {
	type = t;
	name = n;
	leading_space = l;
	trailing_space = "";
    }
コード例 #6
0
ファイル: Token.cs プロジェクト: alfar/WordBuilder
 public Token(TokenType type, string text, int offset, int length)
 {
     m_Type = type;
     m_Text = text;
     m_Offset = offset;
     m_Length = length;
 }
コード例 #7
0
ファイル: CardsTab.cs プロジェクト: emergent-design/quiche
        public void OnCardRead(TokenType type, uint pin, List<ushort> terminals, List<ushort> zones)
        {
            if(!this.InvokeRequired)
            {
                if(this.displayCardData)
                {
                    string tokenType = "User Card";
                    this.displayCardData = false;
                    switch (type)
                    {
                        case TokenType.Proxy: tokenType = "User Proxy Card"; break;
                        case TokenType.AdminToggle: tokenType = "Control Card (Admin Permissions Toggle)"; break;
                        case TokenType.Enrol: tokenType = "Control Card (Enrol)"; break;
                        case TokenType.Revoke: tokenType = "Control Card (Revoke)"; break;
                        case TokenType.Verify: tokenType = "Control Card (Verify)"; break;
                        case TokenType.Access: tokenType = "Control Card (Access Permissions Set)"; break;
                        default: break;
                    }

                    string text = string.Format("Card information: \nType: {0}\nCard ID: {1}\nZones: {2}\nTerminals :{3}", tokenType, pin.ToString(), zones!= null && zones.Count >  0 ? string.Join(", ", zones.ToArray()) : "None", terminals != null && terminals.Count > 0 ? string.Join(", ", terminals.ToArray()) : "None");
                    User u = QuicheProvider.Instance.Client.Get<User>(pin.ToString());
                    if (u!=null && u.Name!= null && u.Name!="") text = string.Format("{0}\nUser: {1}", text, u.Name);
                    MessageBox.Show(text, "QuiRing: Card Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else this.BeginInvoke(new Action<TokenType, uint, List<ushort>, List<ushort>>(this.OnCardRead), type, pin, terminals, zones);
        }
コード例 #8
0
ファイル: Token.cs プロジェクト: davidlblake/WPFConverters
        public bool Equals(TokenType tokenType, string value)
        {
            Debug.Assert(Enum.IsDefined(typeof(TokenType), tokenType));
            Debug.Assert(value != null);

            return (this.type == tokenType) && string.Equals(this.value, value, StringComparison.Ordinal);
        }
コード例 #9
0
ファイル: Token.cs プロジェクト: substans/Sprak
 public Token(TokenType tokenType, string tokenString, int lineNr, int linePosition)
 {
     m_tokenType = tokenType;
     m_tokenString = tokenString;
     m_lineNr = lineNr;
     m_linePosition = linePosition;
 }
コード例 #10
0
ファイル: Token.cs プロジェクト: ajlopez/Acquarella
 public Token(TokenType type, string text, int start, int length)
 {
     this.type = type;
     this.text = text;
     this.start = start;
     this.length = length;
 }
コード例 #11
0
ファイル: Lexer.cs プロジェクト: sekcheong/graphdemo
 public TokenType Scan()
 {
     TokenType t = ScanInternal();
     _context.TokenType = t;
     _lastTokenType = t;
     return t;
 }
コード例 #12
0
ファイル: Lexer.cs プロジェクト: sekcheong/graphdemo
 internal static OperatorType GetOperatorType(TokenType type)
 {
     if (type == TokenType.OP_UMINUS) return OperatorType.UNARY;
     if (type == TokenType.OP_UPLUS) return OperatorType.UNARY;
     if (type == TokenType.OP_UNOT) return OperatorType.UNARY;
     return OperatorType.BINARY;
 }
コード例 #13
0
 public CLexer()
 {
     m_strExpr = "";
     m_nNextPos = 0;
     m_PreviousTokenType = TokenType.T_EOL;
     m_currToken = new Token();
 }
コード例 #14
0
        public UnaryExpression(TokenType op, Expression operand)
        {
            if (operand != null)
                AddChild (operand, OperandRole);

            Operator = op;
        }
コード例 #15
0
 static XmlTokens()
 {
     StartComment = new TokenType("StartComment", "<!--");
     EndComment = new TokenType("EndComment", "-->");
     CloseElement = new TokenType("CloseElement", "/>");
     ComplexCloseElement = new TokenType("ComplexCloseElement", "</");
 }
コード例 #16
0
ファイル: Token.cs プロジェクト: Kei-Nanigashi/StarryEyes
 public Token(TokenType type, int debugIndex)
     : this()
 {
     this.Type = type;
     this.Value = null;
     this.DebugIndex = debugIndex;
 }
コード例 #17
0
 public BinaryExpression(int line, int column, Expression lhs, TokenType op, Expression rhs)
     : base(line, column)
 {
     this.lhs = lhs;
     this.op = op;
     this.rhs = rhs;
 }
コード例 #18
0
ファイル: Token.cs プロジェクト: Kei-Nanigashi/StarryEyes
 public Token(TokenType type, string value, int debugIndex)
     : this()
 {
     this.Type = type;
     this.Value = value;
     this.DebugIndex = debugIndex;
 }
コード例 #19
0
ファイル: Token.cs プロジェクト: redoz/LBi.Cli.Arguments
 public Token(TokenType type, string value, int position, int length)
 {
     this.Type = type;
     this.Value = value;
     this.Position = position;
     this.Length = length;
 }
コード例 #20
0
ファイル: Node.cs プロジェクト: danthomas/Parsing
 private Node(Node parent, TokenType tokenType, string text = "")
 {
     Parent = parent;
     TokenType = tokenType;
     Text = text ?? "";
     Children = new List<Node>();
 }
コード例 #21
0
 public override ScriptObject Compute(TokenType type, ScriptObject value) {
     if (type != TokenType.Plus) { return base.Compute(type, value); }
     ScriptTable table = value as ScriptTable;
     if (table == null) throw new ExecutionException(m_Script, this, "table [+] 操作只限两个[table]之间,传入数据类型:" + value.Type);
     ScriptTable ret = m_Script.CreateTable();
     ScriptObject obj = null;
     ScriptScriptFunction func = null;
     foreach (KeyValuePair<object, ScriptObject> pair in m_listObject) {
         obj = pair.Value.Clone();
         if (obj is ScriptScriptFunction) {
             func = (ScriptScriptFunction)obj;
             if (!func.IsStaticFunction) func.SetTable(ret);
         }
         ret.m_listObject[pair.Key] = obj;
     }
     foreach (KeyValuePair<object, ScriptObject> pair in table.m_listObject) {
         obj = pair.Value.Clone();
         if (obj is ScriptScriptFunction) {
             func = (ScriptScriptFunction)obj;
             if (!func.IsStaticFunction) func.SetTable(ret);
         }
         ret.m_listObject[pair.Key] = obj;
     }
     return ret;
 }
コード例 #22
0
ファイル: Token.cs プロジェクト: pazof/markdowndeep
 // Constructor
 public Token(TokenType type, int startOffset, int length, object data = null)
 {
     this.type = type;
     this.startOffset = startOffset;
     this.length = length;
     this.data = data;
 }
コード例 #23
0
 protected MonadicExpression(TextPosition tp, TokenType op, Element exp)
     : base(tp)
 {
     Operator = op;
     Exp = exp;
     AppendChild(Exp);
 }
コード例 #24
0
ファイル: Token.cs プロジェクト: 7shi/cs2fs
 public Token(string name, TokenType t, int line, int column)
 {
     this.Text = name;
     this.Type = t;
     this.Line = line;
     this.Column = column;
 }
コード例 #25
0
 public Token(Regex match, TokenType tokenType, OperationType operationType = OperationType.Operator, TokenDiscardPolicy discardPolicy = TokenDiscardPolicy.Keep)
 {
     m_TokenType = tokenType;
     m_DiscardPolicy = discardPolicy;
     m_OperationType = operationType;
     m_Regex = match;
 }
コード例 #26
0
 public Token(DateTimeOffset created, Guid tokenGuid, string tokenName, TokenType tokenType)
 {
     this.Created = created;
     this.TokenGuid = tokenGuid;
     this.TokenName = tokenName;
     this.TokenType = tokenType;
 }
コード例 #27
0
ファイル: Parser.cs プロジェクト: LorenVS/bacstack
 /// <summary>
 /// Gets the value of the next token of a certain type
 /// </summary>
 /// <param name="type">The type of token to retrieve</param>
 /// <returns>The token's value</returns>
 private string _get(TokenType type)
 {
     var token = _read();
     if (token.Type != type)
         throw new InvalidDataException(token.Type.ToString());
     return token.Value;
 }
コード例 #28
0
ファイル: Token.cs プロジェクト: vetterd/CSBuild
 public Token(TokenType type, string term, int start, int length)
 {
     Start = start;
     Length = length;
     Type = type;
     Term = term;
 }
コード例 #29
0
 public static extern bool DuplicateTokenEx(
     SafeFileHandle hExistingToken,
     uint dwDesiredAccess,
     SecurityAttributes lpTokenAttributes,
     SecurityImpersonationLevel impersonationLevel,
     TokenType tokenType,
     out IntPtr hNewToken);
コード例 #30
0
ファイル: LqlParser.cs プロジェクト: Vanlightly/Logari
        private void DiscardToken(TokenType tokenType)
        {
            if (_lookaheadFirst.TokenType != tokenType)
                throw new LqlParserException(string.Format("Expected {0} but found: {1}", tokenType.ToString().ToUpper(), _lookaheadFirst.Value));

            DiscardToken();
        }
コード例 #31
0
ファイル: Token.cs プロジェクト: agoda-com/GraphQlGenSharp
 public ParsedToken(T value, TokenType tokenType) : base(value, tokenType)
 {
     ParsedValue = value;
 }
コード例 #32
0
        // Process [link] and ![image] directives
        Token ProcessLinkOrImageOrFootnote()
        {
            // Link or image?
            TokenType token_type = SkipChar('!') ? TokenType.img : TokenType.link;

            // Opening '['
            if (!SkipChar('['))
            {
                return(null);
            }

            // Is it a foonote?
            var savepos = Position;

            if (m_Markdown.ExtraMode && token_type == TokenType.link && SkipChar('^'))
            {
                SkipLinespace();

                // Parse it
                string id;
                if (SkipFootnoteID(out id) && SkipChar(']'))
                {
                    // Look it up and create footnote reference token
                    int footnote_index = m_Markdown.ClaimFootnote(id);
                    if (footnote_index >= 0)
                    {
                        // Yes it's a footnote
                        return(CreateToken(TokenType.footnote, new FootnoteReference(footnote_index, id)));
                    }
                }

                // Rewind
                Position = savepos;
            }

            if (DisableLinks && token_type == TokenType.link)
            {
                return(null);
            }

            bool extraMode = m_Markdown.ExtraMode;

            // Find the closing square bracket, allowing for nesting, watching for
            // escapable characters
            Mark();
            int depth = 1;

            while (!Eof)
            {
                char ch = Current;
                if (ch == '[')
                {
                    depth++;
                }
                else if (ch == ']')
                {
                    depth--;
                    if (depth == 0)
                    {
                        break;
                    }
                }

                this.SkipEscapableChar(extraMode);
            }

            // Quit if end
            if (Eof)
            {
                return(null);
            }

            // Get the link text and unescape it
            string link_text = Utils.UnescapeString(Extract(), extraMode);

            // The closing ']'
            SkipForward(1);

            // Save position in case we need to rewind
            savepos = Position;

            // Inline links must follow immediately
            if (SkipChar('('))
            {
                // Extract the url and title
                var link_def = LinkDefinition.ParseLinkTarget(this, null, m_Markdown.ExtraMode);
                if (link_def == null)
                {
                    return(null);
                }

                // Closing ')'
                SkipWhitespace();
                if (!SkipChar(')'))
                {
                    return(null);
                }

                List <string> specialAttributes = null;
                if (extraMode && DoesMatch('{'))
                {
                    int end;
                    specialAttributes = Utils.StripSpecialAttributes(this.Input, this.Position, out end);
                    if (specialAttributes != null)
                    {
                        Position = end;
                    }
                }

                // Create the token
                return(CreateToken(token_type, new LinkInfo(link_def, link_text, specialAttributes)));
            }

            // Optional space or tab
            if (!SkipChar(' '))
            {
                SkipChar('\t');
            }

            // If there's line end, we're allow it and as must line space as we want
            // before the link id.
            if (Eol)
            {
                SkipEol();
                SkipLinespace();
            }

            // Reference link?
            string link_id = null;

            if (Current == '[')
            {
                // Skip the opening '['
                SkipForward(1);

                // Find the start/end of the id
                Mark();
                if (!Find(']'))
                {
                    return(null);
                }

                // Extract the id
                link_id = Extract();

                // Skip closing ']'
                SkipForward(1);
            }
            else
            {
                // Rewind to just after the closing ']'
                Position = savepos;
            }

            // Link id not specified?
            if (string.IsNullOrEmpty(link_id))
            {
                // Use the link text (implicit reference link)
                link_id = Utils.NormalizeLineEnds(link_text);

                // If the link text has carriage returns, normalize
                // to spaces
                if (!object.ReferenceEquals(link_id, link_text))
                {
                    while (link_id.Contains(" \n"))
                    {
                        link_id = link_id.Replace(" \n", "\n");
                    }
                    link_id = link_id.Replace("\n", " ");
                }
            }

            // Find the link definition abort if not defined
            var def = m_Markdown.GetLinkDefinition(link_id);

            if (def == null)
            {
                return(null);
            }

            // Create a token.
            // [FB]: Currently not supported: special attributes on reference links.
            return(CreateToken(token_type, new LinkInfo(def, link_text, null)));
        }
コード例 #33
0
 public Token(TokenType type, object content, int row = 0, int col = 0)
 {
     TokenType = type;
     Content   = content;
     Location  = new Position(row, col);
 }
コード例 #34
0
 static Precedence InfixPrecedenceOf(TokenType la)
 {
     return(_infixPrecedenceTable[(int)la]);
 }
コード例 #35
0
ファイル: Tokenizer.cs プロジェクト: mystborn/TaffyScript
 private Token MakeToken(TokenType type)
 {
     return(new Token(type, _source.Substring(_start, _index - _start), new TokenPosition(_start, _line, _column, _fname)));
 }
コード例 #36
0
 public void Register(ComponentSelector selector, TokenType type)
 {
     selectors[type] = selector;
 }
コード例 #37
0
 public void Register(CompilerComponent component, TokenType type)
 {
     Register(new UnconditionalSelector(component), type);
 }
コード例 #38
0
ファイル: Token.cs プロジェクト: AndrejZilincik/CodeClones
 public Token(TokenType type, string val, int lineNumber)
 {
     this.Type       = type;
     this.Value      = val;
     this.LineNumber = lineNumber;
 }
コード例 #39
0
 public Token(TokenType type, string text, int startPosition)
 {
     Type     = type;
     Text     = text;
     Position = startPosition;
 }
コード例 #40
0
        private Node Statement()
        {
            // | (ID LPAREN) => functionCall  END_STATEMENT
            // | VARIABLE! ASSIGN! expression END_STATEMENT
            // | RETURN expression END_STATEMENT
            // | IF | WHILE | FOR_EACH
            TokenType type = LookAhead(1);

            if (type == TokenType.VARIABLE && LookAhead(2) == TokenType.LPAREN)
            {
                Node funcCall = FunctionCall();
                Match(TokenType.END_STATEMENT);
                return(funcCall);
            }
            else if (type == TokenType.VARIABLE &&

                     ((LookAhead(2) == TokenType.PLUS && LookAhead(3) == TokenType.PLUS) ||    // i++;

                      (LookAhead(2) == TokenType.MINUS) && LookAhead(3) == TokenType.MINUS) || // i--;

                     ((LookAhead(2) == TokenType.PLUS || LookAhead(2) == TokenType.MINUS) &&   // i+=n; or i-=n;
                      LookAhead(3) == TokenType.EQUAL))
            {
                Node selfExpression = Expression();
                Match(TokenType.END_STATEMENT);
                return(selfExpression);
            }
            else if (type == TokenType.VARIABLE || type == TokenType.VAR)
            {
                return(VariableDeclaration());
            }
            else if (type == TokenType.RETURN)
            {
                SourcePosition pos        = Match(TokenType.RETURN).Position;
                Node           expression = Expression();
                Match(TokenType.END_STATEMENT);
                return(new ReturnNode(pos, expression));
            }
            else if (type == TokenType.IF)
            {
                return(If());
            }
            else if (type == TokenType.WHILE)
            {
                return(While());
            }
            else if (type == TokenType.FOR)
            {
                return(For());
            }
            else if (type == TokenType.FUNCTION)
            {
                return(FunctionDeclaration());
            }
            else if (type == TokenType.THIS)
            {
                return(This());
            }
            else if (type == TokenType.TRY)
            {
                return(TryCatch());
            }
            else
            {
                // We only get here if there is token from the lexer
                // that is not handled by parser yet.
                throw new ParserException("Unknown token type " + type);
            }
        }
コード例 #41
0
 public Token(TokenType type, string s)
 {
     tokenType = type;
     sval      = s;
 }
コード例 #42
0
ファイル: ParseTree.cs プロジェクト: kevin-ye/KOS
 protected object GetValue(ParseTree tree, TokenType type, int index)
 {
     return(GetValue(tree, type, ref index));
 }
コード例 #43
0
 public override int GetHashCode()
 {
     return(TokenType.GetHashCode());
 }
コード例 #44
0
ファイル: Token.cs プロジェクト: agoda-com/GraphQlGenSharp
 public Token(object value, TokenType tokenType)
 {
     Value     = value;
     TokenType = tokenType;
 }
コード例 #45
0
ファイル: CssToken.cs プロジェクト: shikiiGithub/AjaxMinCore
 public CssToken(TokenType tokenType, char ch, CssContext context)
     : this(tokenType, new string(ch, 1), context)
 {
 }
コード例 #46
0
ファイル: Deserializer.cs プロジェクト: f-spot/f-spot-xplat
 void UnexpectedEof(TokenType expected)
 {
     throw new ApplicationException(string.Format("Unexpected End of File; expected {0}", expected));
 }
コード例 #47
0
ファイル: Deserializer.cs プロジェクト: f-spot/f-spot-xplat
 Token CheckScan(TokenType expected)
 {
     return(CheckScan(expected, false));
 }
コード例 #48
0
ファイル: Token.cs プロジェクト: agoda-com/GraphQlGenSharp
 public TokenGroup(IEnumerable <Token> values, TokenType tokenType) : base(values, tokenType)
 {
     Values = Values;
 }
コード例 #49
0
ファイル: TokenStream.cs プロジェクト: DatZach/Swift
 public bool Pass(TokenType type)
 {
     return(Peek().Type == type);
 }
コード例 #50
0
ファイル: Deserializer.cs プロジェクト: f-spot/f-spot-xplat
 void UnexpectedToken(TokenType expected, Token got)
 {
     throw new ApplicationException(string.Format("Unexpected token {0} at [{1}:{2}]; expected {3}",
                                                  got.Type, got.SourceLine, got.SourceColumn, expected));
 }
コード例 #51
0
ファイル: FPTToken.cs プロジェクト: chadfebruary/FPT
 public FPTToken(TokenType tokenType, string value)
 {
     this.tokenType = tokenType;
     this.value     = value;
 }
コード例 #52
0
ファイル: TokenStream.cs プロジェクト: DatZach/Swift
 public bool Pass(TokenType type, string value)
 {
     return(Peek().Type == type && Peek().Value == value);
 }
コード例 #53
0
        private TokenType IsSymbol(int simbol)
        {
            simbolWidth = 0;
            TokenType token      = TokenType.UNKNOW;
            int       nextSimbol = -1;

            if ((index + 1) < len)
            {
                nextSimbol = _string[index + 1];
            }

            switch (simbol)
            {
            case '{':
                token       = TokenType.LCURLY;
                simbolWidth = 1;
                break;

            case '}':
                token       = TokenType.RCURLY;
                simbolWidth = 1;
                break;

            case '[':
                token       = TokenType.LBRACK;
                simbolWidth = 1;
                break;

            case ']':
                token       = TokenType.RBRACK;
                simbolWidth = 1;
                break;

            case ':':
                token       = TokenType.COLON;
                simbolWidth = 1;
                break;

            case ',':
                token       = TokenType.SEMICOLON;
                simbolWidth = 1;
                break;

            case '.':
                token       = TokenType.DOT;
                simbolWidth = 1;
                break;

            case '<':
                if (nextSimbol == '=')
                {
                    token       = TokenType.LEQUAL;
                    simbolWidth = 2;
                }
                else
                {
                    token       = TokenType.LESS;
                    simbolWidth = 1;
                }
                break;

            case '>':
                if (nextSimbol == '=')
                {
                    token       = TokenType.GEQUAL;
                    simbolWidth = 2;
                }
                else
                {
                    token       = TokenType.GREATER;
                    simbolWidth = 1;
                }
                break;

            case '=':
                token       = TokenType.EQUAL;
                simbolWidth = 1;
                break;

            case '!':
                if (nextSimbol == '=')
                {
                    token       = TokenType.NEQUAL;
                    simbolWidth = 2;
                }
                else
                {
                    throw new TokenMismatchException("only ! found ,expected !=");
                }

                break;

            case '(':
                token       = TokenType.LPARENT;
                simbolWidth = 1;
                break;

            case ')':
                token       = TokenType.RPARENT;
                simbolWidth = 1;
                break;

            case '-':
                token       = TokenType.SUB;
                simbolWidth = 1;
                break;

            case '+':
                token       = TokenType.PLUS;
                simbolWidth = 1;
                break;

            case '*':
                token       = TokenType.MUL;
                simbolWidth = 1;
                break;

            case '/':
                token       = TokenType.DIV;
                simbolWidth = 1;
                break;

            case '?':
                token       = TokenType.QUESTION;
                simbolWidth = 1;
                break;
            }
            return(token);
        }
コード例 #54
0
        //解析区域代码内容( {} 之间的内容)
        private ScriptExecutable ParseStatementBlock(Executable_Block block, bool readLeftBrace, TokenType finished)
        {
            BeginExecutable(block);
            if (readLeftBrace && PeekToken().Type != TokenType.LeftBrace)
            {
                ParseStatement();
            }
            else
            {
                if (readLeftBrace)
                {
                    ReadLeftBrace();
                }
                TokenType tokenType;
                while (HasMoreTokens())
                {
                    tokenType = ReadToken().Type;
                    if (tokenType == finished)
                    {
                        break;
                    }
                    UndoToken();
                    ParseStatement();
                }
            }
            ScriptExecutable ret = m_scriptExecutable;

            ret.EndScriptInstruction();
            EndExecutable();
            return(ret);
        }
コード例 #55
0
ファイル: Utils.cs プロジェクト: secureiqlab/LOLBITS
 public static void DuplicateToken(IntPtr token, TokenAccessFlags tokenAccess, SecurityImpersonationLevel se, TokenType type, out IntPtr duplicated)
 {
     if (!DuplicateTokenEx(token, tokenAccess, IntPtr.Zero, se, type, out duplicated))
     {
         duplicated = IntPtr.Zero;
     }
 }
コード例 #56
0
ファイル: FPTToken.cs プロジェクト: chadfebruary/FPT
 public FPTToken(TokenType tokenType)
 {
     this.tokenType = tokenType;
     value          = string.Empty;
 }
コード例 #57
0
ファイル: CssToken.cs プロジェクト: shikiiGithub/AjaxMinCore
 public CssToken(TokenType tokenType, [Localizable(false)] string text, CssContext context)
 {
     m_tokenType = tokenType;
     m_text      = text;
     m_context   = context.Clone();
 }
コード例 #58
0
        protected Token GetNextTokenFromStream()
        {
            SkipSpaces();
            int simbol = Peek();

            if (simbol == -1)
            {
                return(null);
            }

            String value;

            TokenType tokenType = IsSymbol(simbol);

            if (tokenType != TokenType.UNKNOW)
            {
                value = _string.Substring(index, simbolWidth);
                Skip(simbolWidth);
                return(new Token(tokenType, value));
            }

            if (simbol == '\'')
            {
                value = ReadString();
                return(new Token(TokenType.STRING, value));
            }
            else if (char.IsDigit((char)simbol))
            {
                value  = ReadInteger();
                simbol = Peek();
                if (simbol == -1 || IsWhiteSpace(simbol))
                {
                    return(new Token(TokenType.INT, value));
                }

                TokenType token = IsSymbol(simbol);
                if (token == TokenType.DOT)
                {
                    Read();
                    return(new Token(TokenType.DOUBLE, value + "." + ReadInteger()));
                }
                else if (token != TokenType.UNKNOW)
                {
                    return(new Token(TokenType.INT, value));
                }
                else
                {
                    throw new TokenMismatchException(String.Format("expecting number at COL: {0} ROW: {1}", Col, Row));
                }
            }
            else if (simbol == '_' || Char.IsLetter((char)simbol))
            {
                value = ReadWord(simbol);
                TokenType keyword = GetKeyword(value);
                if (keyword != TokenType.UNKNOW)
                {
                    return(new Token(keyword, value));
                }
                return(new Token(TokenType.ID, value));
            }

            return(null);
        }
コード例 #59
0
 public bool MatchToken(TokenType clazz, string value)
 {
     return(position < tokens.Count && tokens[position].TokenClass == clazz && tokens[position].Value.ToString() == value.ToString());
 }
コード例 #60
0
 internal static extern bool DuplicateTokenEx([In] SafeTokenHandle ExistingTokenHandle, [In] TokenAccessLevels DesiredAccess, [In] IntPtr TokenAttributes, [In] SecurityImpersonationLevel ImpersonationLevel, [In] TokenType TokenType, [In][Out] ref SafeTokenHandle DuplicateTokenHandle);