Example #1
0
        static int Main(string[] args)
        {
            string            invokedVerb         = null;
            IVisitableOptions invokedVerbInstance = null;

            var options = new Options();

            bool parsed = CommandLine.Parser.Default.ParseArguments(args, options, (verb, subOptions) =>
            {
                invokedVerb         = verb;
                invokedVerbInstance = (IVisitableOptions)subOptions;
            });

            var logger = new ConsoleLogger();

            if (!parsed)
            {
                // write args
                LogInvalidArgs(args, logger);
                logger.LogInfo(options.GetUsage());
                return(-1);
            }

            var commandVisitor = new CommandVisitor(logger);

            invokedVerbInstance.Accept(commandVisitor);

            if (!commandVisitor.Success)
            {
                return(-1);
            }

            return(0);
        }
Example #2
0
        public static IList <string> GetCommandList(MenuResource resource)
        {
            List <string>  commands = new List <string>();
            CommandVisitor visitor  = new CommandVisitor(commands);

            visitor.Visit(resource.Menu);
            return(commands);
        }
Example #3
0
        internal bool RenderCommand(HScriptParser.CommandContext Context, CommandVisitor Processor)
        {

            // Consume //
            CommandPlan plan;
            try
            {
                plan = Processor.Visit(Context);
            }
            catch (HScriptCompileException hce)
            {
                this.Home.IO.Communicate(string.Format("Compile Error for statement {0}", this._CompileCount));
                this.Home.IO.Communicate(Context.GetText());
                this.Home.IO.Communicate(hce.Message);
                return false;
            }

            // Add the header to the plan buffer //
            if (!this.Home.SupressIO)
                this.Home.IO.Communicate();

            // Execute //
            try
            {
                plan.Execute();
            }
            catch (HorseDataException hde)
            {

                this.Home.IO.Communicate(string.Format("Compile Error for statement {0}", this._CompileCount));
                this.Home.IO.Communicate(hde.Message);
                return false;

            }

            // Communicate //
            if (!this.Home.SupressIO)
            {

                // Append the write stack //
                this.Home.IO.Communicate(plan.MessageText());

                // Dump the buffer //
                this.Home.IO.FlushStringBuffer();
                this.Home.IO.FlushRecordBuffer();

            }

            return true;

        }
Example #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean handle(org.neo4j.kernel.impl.api.CommandVisitor handler) throws java.io.IOException
            public override bool Handle(CommandVisitor handler)
            {
                return(handler.VisitSchemaRuleCommand(this));
            }
Example #5
0
 public override void Accept(CommandVisitor visitor)
 {
     visitor.VisitSetGlobalVariableCommand(this);
 }
Example #6
0
 public override void Accept(CommandVisitor visitor)
 {
     visitor.VisitStopMusicCommand(this);
 }
Example #7
0
 public override void Accept(CommandVisitor visitor)
 {
     visitor.VisitSetImageCommand(this);
 }
Example #8
0
 public override void Accept(CommandVisitor visitor)
 {
     visitor.VisitClearLocalVariablesCommand(this);
 }
Example #9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean handle(org.neo4j.kernel.impl.api.CommandVisitor visitor) throws java.io.IOException
            public override bool Handle(CommandVisitor visitor)
            {
                return(visitor.VisitIndexCreateCommand(this));
            }
Example #10
0
 public override void Accept(CommandVisitor visitor)
 {
     visitor.VisitAwaitInputCommand(this);
 }
Example #11
0
 public override void Accept(CommandVisitor visitor)
 {
     visitor.VisitTextCommand(this);
 }
Example #12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean handle(org.neo4j.kernel.impl.api.CommandVisitor handler) throws java.io.IOException
            public override bool Handle(CommandVisitor handler)
            {
                return(handler.VisitRelationshipTypeTokenCommand(this));
            }
Example #13
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean handle(org.neo4j.kernel.impl.api.CommandVisitor handler) throws java.io.IOException
            public override bool Handle(CommandVisitor handler)
            {
                return(handler.VisitLabelTokenCommand(this));
            }
Example #14
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean handle(org.neo4j.kernel.impl.api.CommandVisitor handler) throws java.io.IOException
            public override bool Handle(CommandVisitor handler)
            {
                return(handler.VisitPropertyKeyTokenCommand(this));
            }
Example #15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean handle(org.neo4j.kernel.impl.api.CommandVisitor handler) throws java.io.IOException
            public override bool Handle(CommandVisitor handler)
            {
                return(handler.VisitNeoStoreCommand(this));
            }
Example #16
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public abstract boolean handle(org.neo4j.kernel.impl.api.CommandVisitor handler) throws java.io.IOException;
        public abstract bool Handle(CommandVisitor handler);
Example #17
0
 public CommandVisitor_Delegator(CommandVisitor @delegate)
 {
     this.Delegate = @delegate;
 }
Example #18
0
 public void accept(CommandVisitor visit)
 {
     visit.visit(this);
 }
Example #19
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean handle(org.neo4j.kernel.impl.api.CommandVisitor handler) throws java.io.IOException
            public override bool Handle(CommandVisitor handler)
            {
                return(handler.VisitNodeCountsCommand(this));
            }
Example #20
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean handle(org.neo4j.kernel.impl.api.CommandVisitor handler) throws java.io.IOException
            public override bool Handle(CommandVisitor handler)
            {
                return(handler.VisitRelationshipCountsCommand(this));
            }
Example #21
0
        public void Execute(string Script)
        {

            // Load the command stack //
            this.LoadCommandStack(Script);

            // Check to see if there were parser errors //
            if (this._CompileErrorMessages.Count != 0)
            {
                this.Home.IO.AppendBuffer("Parsing Error");
                foreach (string s in this._CompileErrorMessages)
                    this.Home.IO.AppendBuffer('\t' + s);
                this.Home.IO.AppendBuffer("Process terminated");
                this.Home.IO.FlushStringBuffer();
                return;
            }

            // Create an executer object //
            CommandVisitor processor = new CommandVisitor(this.Home);
            
            // Run ... //
            foreach(HScriptParser.CommandContext ctx in this.Commands)
            {

                this._CompileCount++;
                bool Sucsess = this.RenderCommand(ctx, processor);
                if (!Sucsess && this._ExitAfterException)
                {
                    this.Home.IO.Communicate("Process terminated after critical HorseDataException");
                    break;
                }

            }


        }
Example #22
0
 public override void Accept(CommandVisitor visitor)
 {
     visitor.VisitPlaySoundCommand(this);
 }
Example #23
0
 public override void Accept(CommandVisitor visitor)
 {
     visitor.VisitBackgroundLoadCommand(this);
 }
Example #24
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean handle(org.neo4j.kernel.impl.api.CommandVisitor visitor) throws java.io.IOException
            public override bool Handle(CommandVisitor visitor)
            {
                return(visitor.VisitIndexAddRelationshipCommand(this));
            }
Example #25
-1
        internal void LoadCommandStack(string Script)
        {

            // Clear the current stack //
            this.Commands.Clear();
            this._CompileErrorMessages.Clear();

            // Create a token stream and do lexal analysis //
            AntlrInputStream TextStream = new AntlrInputStream(Script);
            HScriptLexer HorseLexer = new HScriptLexer(TextStream);

            // Parse the script //
            CommonTokenStream HorseTokenStream = new CommonTokenStream(HorseLexer);
            HScriptParser HorseParser = new HScriptParser(HorseTokenStream);
            HorseParser.RemoveErrorListeners();
            HorseParser.AddErrorListener(new ParserErrorListener());
            
            // Create an executer object //
            CommandVisitor processor = new CommandVisitor(this.Home);

            // Load the call stack //
            try
            {
                foreach (HScriptParser.CommandContext context in HorseParser.compile_unit().command_set().command())
                {
                    this.Commands.Add(context);
                }
            }
            catch (Exception e)
            {
                this._CompileErrorMessages.Add(e.Message);
            }

        }