Exemplo n.º 1
0
        /// <summary>
        ///		Interpreta un bloque de sentencias
        /// </summary>
        private SentenceCollection ParseBlockSentences(TokenSqlSeparator.SeparatorType endBlock)
        {
            SentenceCollection sentences = new SentenceCollection();
            TokenSqlBase       token     = Lexer.LookUp();

            // Mientras haya algún token que leer
            while (!HasError && !(token is TokenSqlEof) && !FoundToken(token, endBlock))
            {
                // Añade las sentencias
                sentences.Add(ParseSentence());
                // Mira el siguiente token (sin sacarlo de la pila)
                token = Lexer.LookUp();
            }
            // Si el token que hemos encontrado no es el de fin de bloque, añadimos un error
            if (!FoundToken(token, endBlock))
            {
                AddError("Error when read sentences block. Waiting end block", token);
            }
            else                     // quita el token de fin de sentencia de la pila
            {
                Lexer.Next();
            }
            // Devuelve la colección de sentencias
            return(sentences);
        }
Exemplo n.º 2
0
        public SentenceCollection CreateCollection()
        {
            SentenceCollection list = new SentenceCollection();
            foreach (var pair in this)
            {
                list.Add(new Sentence { Zin = pair.Key, Vertaald = pair.Value != null, Translation = pair.Value});
            }

            return list;
        }
Exemplo n.º 3
0
        /// <summary>
        ///		Interpreta una colección de sentencias
        /// </summary>
        private SentenceCollection ParseSentences()
        {
            SentenceCollection sentences = new SentenceCollection();

            // Mientras haya algún token que leer
            do
            {
                sentences.Add(ParseSentence());
            }while (!HasError && !(Lexer.LookUp() is TokenSqlEof));
            // Devuelve la colección de sentencias
            return(sentences);
        }
Exemplo n.º 4
0
        /// <summary>
        ///		Carga las instrucciones de una serie de nodos
        /// </summary>
        private SentenceCollection LoadSentences(MLNodesCollection nodesML, string pathBase)
        {
            SentenceCollection sentences = new SentenceCollection();

            // Lee las instrucciones
            foreach (MLNode nodeML in nodesML)
            {
                switch (nodeML.Name)
                {
                case TagImport:
                    sentences.AddRange(LoadByFile(System.IO.Path.Combine(pathBase, nodeML.Attributes[TagFileName].Value)).Sentences);
                    break;

                case TagSentenceBlock:
                    sentences.Add(LoadSentenceBlock(nodeML, pathBase));
                    break;

                case TagSentenceExecute:
                    sentences.Add(LoadSentenceExecute(nodeML));
                    break;

                case TagSentenceException:
                    sentences.Add(LoadSentenceException(nodeML));
                    break;

                case TagSentenceBulkCopy:
                    sentences.Add(LoadSentenceBulkCopy(nodeML));
                    break;

                case TagSentenceCopy:
                    sentences.Add(LoadSentenceCopy(nodeML));
                    break;

                case TagSentenceForEach:
                    sentences.Add(LoadSentenceForEach(nodeML, pathBase));
                    break;

                case TagSentenceIfExists:
                    sentences.Add(LoadSentenceIfExists(nodeML, pathBase));
                    break;

                case TagSentenceIf:
                    sentences.Add(LoadSentenceIf(nodeML, pathBase));
                    break;

                case TagSentenceString:
                    sentences.Add(LoadSentenceDeclare(nodeML, VariableModel.VariableType.String));
                    break;

                case TagSentenceNumeric:
                    sentences.Add(LoadSentenceDeclare(nodeML, VariableModel.VariableType.Numeric));
                    break;

                case TagSentenceBoolean:
                    sentences.Add(LoadSentenceDeclare(nodeML, VariableModel.VariableType.Boolean));
                    break;

                case TagSentenceDate:
                    sentences.Add(LoadSentenceDeclare(nodeML, VariableModel.VariableType.Date));
                    break;

                case TagSentenceLet:
                    sentences.Add(LoadSentenceLet(nodeML));
                    break;

                case TagSentenceFor:
                    sentences.Add(LoadSentenceFor(nodeML, pathBase));
                    break;

                case TagSentenceWhile:
                    sentences.Add(LoadSentenceWhile(nodeML, pathBase));
                    break;

                case TagSentencePrint:
                    sentences.Add(LoadSentencePrint(nodeML));
                    break;

                case TagSentenceBeginTransaction:
                    sentences.Add(LoadSentenceBatch(nodeML, SentenceDataBatch.BatchCommand.BeginTransaction));
                    break;

                case TagSentenceCommitTransaction:
                    sentences.Add(LoadSentenceBatch(nodeML, SentenceDataBatch.BatchCommand.CommitTransaction));
                    break;

                case TagSentenceRollbackTransaction:
                    sentences.Add(LoadSentenceBatch(nodeML, SentenceDataBatch.BatchCommand.RollbackTransaction));
                    break;

                case TagSentenceAssertExecute:
                    sentences.Add(LoadSentenceAssertExecute(nodeML));
                    break;

                case TagSentenceAssertScalar:
                    sentences.Add(LoadSentenceAssertScalar(nodeML));
                    break;

                case TagSentenceExecuteScript:
                    sentences.Add(LoadSentenceExecuteScript(nodeML));
                    break;

                case TagSentenceImportCsv:
                    sentences.Add(LoadSentenceImportCsv(nodeML));
                    break;

                case TagSentenceImportSchemaCsv:
                    sentences.Add(LoadSentenceImportSchema(nodeML));
                    break;

                case TagSentenceExportSchemaCsv:
                    sentences.Add(LoadSentenceExportSchema(nodeML));
                    break;

                case TagSentenceExportCsv:
                    sentences.Add(LoadSentenceExportCsv(nodeML));
                    break;

                case TagSentenceExportPartitionedCsv:
                    sentences.Add(LoadSentenceExportPartitionedCsv(nodeML));
                    break;

                case TagSentenceExportParquet:
                    sentences.Add(LoadSentenceExportParquet(nodeML));
                    break;

                case TagSentenceImportParquet:
                    sentences.Add(LoadSentenceImportParquet(nodeML));
                    break;

                default:
                    throw new ArgumentException($"Node unkwnown: {nodeML.Name}");
                }
            }
            // Devuelve la colección
            return(sentences);
        }