Imports System.Text.RegularExpressions
Imports System.Collections.Generic
Imports System
Imports System.Linq
Public Module Module1
Public Function ExtrairBlocos(ByVal texto As String) As List(Of String)
Dim blocos As List(Of String)
blocos = Regex.Split(texto, "(""[^""]*""|\s+)").ToList()
blocos.RemoveAll(Function(bloco) String.IsNullOrWhiteSpace(bloco))
Return blocos
End Function
Sub Main()
Dim texto As String = "if ""esse campo tem espaços"" = true"
Dim blocos As New List(Of String)
blocos = ExtrairBlocos(texto)
For Each bloco As String In blocos
Console.WriteLine("{0}", bloco)
Next
Console.ReadLine()
End Sub
End Module
SW1wb3J0cyBTeXN0ZW0uVGV4dC5SZWd1bGFyRXhwcmVzc2lvbnMKSW1wb3J0cyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYwpJbXBvcnRzIFN5c3RlbQpJbXBvcnRzIFN5c3RlbS5MaW5xCgpQdWJsaWMgTW9kdWxlIE1vZHVsZTEKCglQdWJsaWMgRnVuY3Rpb24gRXh0cmFpckJsb2NvcyhCeVZhbCB0ZXh0byBBcyBTdHJpbmcpIEFzIExpc3QoT2YgU3RyaW5nKQogICAgICAgIERpbSBibG9jb3MgQXMgTGlzdChPZiBTdHJpbmcpCgkJYmxvY29zID0gUmVnZXguU3BsaXQodGV4dG8sICIoIiJbXiIiXSoiInxccyspIikuVG9MaXN0KCkKICAgICAgICBibG9jb3MuUmVtb3ZlQWxsKEZ1bmN0aW9uKGJsb2NvKSBTdHJpbmcuSXNOdWxsT3JXaGl0ZVNwYWNlKGJsb2NvKSkKICAgICAgICBSZXR1cm4gYmxvY29zCiAgICBFbmQgRnVuY3Rpb24KCiAgICBTdWIgTWFpbigpCiAgICAgICAgRGltIHRleHRvIEFzIFN0cmluZyA9ICJpZiAiImVzc2UgY2FtcG8gdGVtIGVzcGHDp29zIiIgPSB0cnVlIgogICAgICAgIERpbSBibG9jb3MgQXMgTmV3IExpc3QoT2YgU3RyaW5nKQogICAgICAgIGJsb2NvcyA9IEV4dHJhaXJCbG9jb3ModGV4dG8pCgogICAgICAgIEZvciBFYWNoIGJsb2NvIEFzIFN0cmluZyBJbiBibG9jb3MKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoInswfSIsIGJsb2NvKQogICAgICAgIE5leHQKICAgICAgICBDb25zb2xlLlJlYWRMaW5lKCkKICAgIEVuZCBTdWIKCkVuZCBNb2R1bGUK
Visual Basic.Net Compiler version 0.0.0.5943 (Mono 3.8 - tarball)
Copyright (C) 2004-2010 Rolf Bjarne Kvinge. All rights reserved.
/home/A3HpK2/prog.vb (11,35) : error VBNC90019: Expected ')'.
/home/A3HpK2/prog.vb (11,35): Compiler error around this location, the compiler hasn't implemented the error message, nor error recovery, so the compiler will probably crash soon.
at vbnc.Helper.ErrorRecoveryNotImplemented(Span Location)
at vbnc.Parser.ParseInvocationOrIndexExpression(vbnc.ParsedObject Parent, vbnc.Expression First)
at vbnc.Parser.ParseIdentifier(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseExponent(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseUnaryPlusMinus(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseMultDiv(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseIntDiv(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseMod(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParsePlusMinus(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseConcat(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseBitshift(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseComparison(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseNot(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseAnd_AndAlso(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseOr_OrElse_Xor(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseExpression(vbnc.ExpressionParseInfo Info)
at vbnc.Parser.ParseCodeBlock(vbnc.ParsedObject Parent, Boolean IsOneLiner)
at vbnc.Parser.ParseFunctionDeclaration(vbnc.TypeDeclaration Parent, vbnc.ParseAttributableInfo Info)
at vbnc.Parser.ParseTypeMembers(vbnc.TypeDeclaration Parent)
at vbnc.Parser.ParseModuleDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
at vbnc.Parser.ParseTypeDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
at vbnc.Parser.ParseAssemblyMembers(vbnc.AssemblyDeclaration Parent, System.String RootNamespace)
at vbnc.Parser.ParseAssemblyDeclaration(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
at vbnc.Parser.Parse(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
at vbnc.Compiler.Compile_Parse()
at vbnc.Compiler.Compile()
at vbnc.Compiler.Compile(System.String[] CommandLine)
at vbnc.Main.Main(System.String[] CmdArgs)
/home/A3HpK2/prog.vb (11,35) : error VBNC90019: Expected 'End'.
/home/A3HpK2/prog.vb (12,15) : error VBNC90019: Expected 'End'.
/home/A3HpK2/prog.vb (13,17) : error VBNC30203: Identifier expected.
/home/A3HpK2/prog.vb (15,8) : error VBNC30203: Identifier expected.
/home/A3HpK2/prog.vb (16,12) : error VBNC30203: Identifier expected.
/home/A3HpK2/prog.vb (17,12) : error VBNC30203: Identifier expected.
/home/A3HpK2/prog.vb (18,15) : error VBNC30203: Identifier expected.
/home/A3HpK2/prog.vb (20,12) : error VBNC30203: Identifier expected.
/home/A3HpK2/prog.vb (21,20) : error VBNC30203: Identifier expected.
/home/A3HpK2/prog.vb (22,13) : error VBNC30203: Identifier expected.
/home/A3HpK2/prog.vb (23,16) : error VBNC30203: Identifier expected.
/home/A3HpK2/prog.vb (24,12) : error VBNC30203: Identifier expected.
/home/A3HpK2/prog.vb (26,11) : error VBNC30203: Identifier expected.
There were 14 errors and 0 warnings.
Compilation took 00:00:00.6511920