Files
2025-03-19 08:09:00 +01:00

25 lines
2.3 KiB
VB.net

Imports System.Text.RegularExpressions
Module RegexM
#Region "FIELDS & PROPERTIES"
' Precompilare regex con ottimizzazione globale
Public ReadOnly KeywordRegex As New Regex("\b(?:local|end|if|then|else|for|while|do|return|true|nil|_ENV|_G)\b", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly ValueRegex As New Regex("\.(CMP_Draw|N1|V1|T1|Npar|Nome|INFO|WithInt|CMP|GLOB|ROOT)\b", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly FunctionRegex As New Regex("\bfunction\b", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly InfoRegex As New Regex("'([^']*)'", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly EgtRegex As New Regex("\b\w+(?=\s*\()", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly TextRegex As New Regex("\b\w+(?=\[)(?!.*[\(\{])", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly BracketRegex As New Regex("[()\[\]{}]", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly NumberRegex As New Regex("\b\d+\b", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly CommentRegex As New Regex("--.*$", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly FreeRegex As New Regex("\b[a-zA-Z_]\w*(?=\s*=\s*)", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly PointRegex As New Regex("\b(?!table\b)\w+(?=\.)", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly TableRegex As New Regex("\btable\b", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
Public ReadOnly EqualRegex As New Regex("\b\w+(?=\s=)", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace)
#End Region ' Fields & Properties
End Module