Define all necessary operations for a string parser.
 protected override void OnCommandSent( object sender, CommandSentEventArgs e )
 {
     CommandParser p = new CommandParser(e.Command);
     string str;
     if( p.IsIdentifier( out str ) && !e.Canceled && str == CMDSendKey )
     {
         if( str == CMDSendKey ) SendKey( p.StringValue );
     }
 }
示例#2
0
 static void ParseAll(string s)
 {
     CommandParser p = new CommandParser(s);
     while (p.CurrentToken != CommandParser.Token.EndOfInput) p.GetNextToken();
 }
示例#3
0
 static void CkeckNotIdentifier(string s, int idNotPos)
 {
     CommandParser p = new CommandParser(s);
     while (idNotPos-- > 0) p.GetNextToken();
     Debug.Assert(p.CurrentToken != CommandParser.Token.Identifier);
 }
示例#4
0
 static void CheckString(string s, int idPos, string strVal)
 {
     CommandParser p = new CommandParser(s);
     while (idPos-- > 0) p.GetNextToken();
     Debug.Assert(p.CurrentToken == CommandParser.Token.String
         && p.StringValue == strVal);
 }
示例#5
0
 static void CheckIdentifier(string s, int idPos, string identifier)
 {
     CommandParser p = new CommandParser(s);
     while (idPos-- > 0) p.GetNextToken();
     Debug.Assert(p.CurrentToken == CommandParser.Token.Identifier
         && p.Identifier == identifier);
 }
示例#6
0
        protected override void OnCommandSent( object sender, CommandSentEventArgs e )
        {
            string cmd;
            string m;

            CommandParser p = new CommandParser( e.Command );

            if( !e.Canceled && p.IsIdentifier( out cmd ) && cmd == CMD )
            {
                if( p.Match( CommandParser.Token.OpenPar ) )
                    if( p.IsString( out m ) )
                        if( p.Match( CommandParser.Token.ClosePar ) )
                            if( cmd == CMD )
                                Exec( m );
            }
        }
示例#7
0
        protected override void OnCommandSent( object sender, CommandSentEventArgs e )
        {
            string cmd;
            string sub;
            string m;

            CommandParser p = new CommandParser( e.Command );

            if( !e.Canceled && p.IsIdentifier( out cmd ) && cmd == CMDChangeMode )
            {
                if( p.MatchIsolatedChar( '.' ) )
                {
                    p.IsIdentifier( out sub );
                    sub = sub.ToLower();

                    if( p.Match( CommandParser.Token.OpenPar ) )
                        if( p.IsString( out m ) )
                            if( p.Match( CommandParser.Token.ClosePar ) )
                            {
                                if( cmd == CMDChangeMode )
                                {
                                    switch( sub )
                                    {
                                        case "add": Add( m ); return;
                                        case "remove": Remove( m ); return;
                                        case "set": ChangeMode( m ); return;
                                        case "toggle": Toggle( m ); return;
                                    }
                                }
                            }
                }
            }
        }
        protected override void OnCommandSent( object sender, CommandSentEventArgs e )
        {
            if( !e.Canceled )
            {
                CommandParser p = new CommandParser( e.Command );
                if( p.MatchIdentifier( CMD ) )
                {
                    string eventKey;
                    string eventName;

                    if( p.MatchIsolatedChar( '.' ) )
                    {
                        if( p.IsIdentifier( out eventName ) )
                        {
                            if( p.Match( CommandParser.Token.OpenPar ) )
                            {
                                if( p.IsString( out eventKey ) )
                                {
                                    if( p.Match( CommandParser.Token.ClosePar ) )
                                    {
                                        if( p.MatchIsolatedChar( ':' ) )
                                        {
                                            Parse( eventKey, eventName, e.Command.Split( ':' )[1] );
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }