daily update on 20250210 by nitload youmu
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpSchema.cs"
|
||||
// file="ExpSchemaSource.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
@@ -43,39 +43,6 @@ namespace StgSharp.Script.Express
|
||||
{
|
||||
public partial class ExpSchemaSource
|
||||
{
|
||||
[GeneratedRegex(@"\s*END_CONSTANT;")]
|
||||
private static partial Regex GetConstDefineEnd();
|
||||
|
||||
private static Regex
|
||||
_constDefineBegin = GetConstDefineBegin(),
|
||||
_constDefineEnd = GetConstDefineEnd(),
|
||||
_schemaBegin = GetSchemaBegin(),
|
||||
_schemaEnd = new Regex(
|
||||
@"END_SCHEMA;\s*--\s*(?<namespace>[A-Za-z0-9_]+)",
|
||||
RegexOptions.Compiled ),
|
||||
_entityDefineBegin = new Regex(
|
||||
@"\s*ENTITY\s*(?<TypeName>[A-Za-z0-9_]+)\s*", RegexOptions.Compiled ),
|
||||
_entityDefineEnd = new Regex(
|
||||
@"\s*END_ENTITY;\s*--\s*(?<TypeName>[A-Za-z0-9_]+)\s*",
|
||||
RegexOptions.Compiled ),
|
||||
_typeDefineBegin = new Regex(
|
||||
@"\s*TYPE\s+(?<TypeName>[A-Za-z0-9_]+)\s*=\s*(?<Remaining>[A-Z]+)",
|
||||
RegexOptions.Compiled ),
|
||||
_typeDefineEnd = new Regex(
|
||||
@"\s*END_TYPE\s*;\s*--\s*(?<TypeName>[a-zA-Z0-9_]+)",
|
||||
RegexOptions.Compiled ),
|
||||
_functionDefineBegin = new Regex(
|
||||
@"\s*FUNCTION\s*\s*(?<FunctionName>[a-zA-Z0-9_]+)\s*(?<Remaining>.*)",
|
||||
RegexOptions.Compiled ),
|
||||
_functionDefineEnd = new Regex(
|
||||
@"\s*END_FUNCTION\s*;\s*--\s*(?<FunctionName>[a-zA-Z0-9_]+)",
|
||||
RegexOptions.Compiled ),
|
||||
_ruleDefineBegin = new Regex(
|
||||
@"\s*RULE\s*(?<RuleName>[a-zA-Z0-9_]+)\s*FOR\s*\((?<Target>[a-zA-Z0-9_]*(\s*\)\s*;)?)",
|
||||
RegexOptions.Compiled ),
|
||||
_ruleDefineEnd = new Regex(
|
||||
@"\s*END_RULE\s*;\s*--\s*(?<RuleName>[A-Za-z0-9_]+)",
|
||||
RegexOptions.Compiled );
|
||||
|
||||
private Dictionary<string, IExpElementSource> _sourceCache = new();
|
||||
|
||||
@@ -83,16 +50,14 @@ namespace StgSharp.Script.Express
|
||||
|
||||
private string name;
|
||||
|
||||
public string Name
|
||||
public ExpSchemaSource() { }
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => _compileResult.Name;
|
||||
internal set => _compileResult.Name = value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ExpSchemaSource() { }
|
||||
|
||||
public void ReadSchema( ExpFileSource reader )
|
||||
{
|
||||
string line = reader.ReadLine();
|
||||
@@ -159,6 +124,15 @@ namespace StgSharp.Script.Express
|
||||
return true;
|
||||
}
|
||||
|
||||
[GeneratedRegex( @"\s*CONSTANT" )]
|
||||
private static partial Regex GetConstDefineBegin();
|
||||
|
||||
[GeneratedRegex( @"\s*END_CONSTANT;" )]
|
||||
private static partial Regex GetConstDefineEnd();
|
||||
|
||||
[GeneratedRegex( @"\s*SCHEMA\s*(?<namespace>[A-Za-z0-9_]+)\s?;" )]
|
||||
private static partial Regex GetSchemaBegin();
|
||||
|
||||
private bool TryReadConst(
|
||||
string firstLine,
|
||||
ExpFileSource reader,
|
||||
@@ -167,7 +141,7 @@ namespace StgSharp.Script.Express
|
||||
Match match = _constDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_CONSTANT",reader.Location );
|
||||
"END_CONSTANT", reader.Location );
|
||||
ExpConstantCollectionSource _source = new ExpConstantCollectionSource(
|
||||
transmitter );
|
||||
string line = reader.ReadLine();
|
||||
@@ -191,7 +165,7 @@ namespace StgSharp.Script.Express
|
||||
Match match = _entityDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_ENTITY", reader.Location);
|
||||
"END_ENTITY", reader.Location );
|
||||
ExpEntitySource _source = new ExpEntitySource(
|
||||
match.Groups[ "TypeName" ].ToString(), transmitter );
|
||||
string line = reader.ReadLine();
|
||||
@@ -222,7 +196,7 @@ namespace StgSharp.Script.Express
|
||||
Match match = _functionDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_FUNCTION", reader.Location);
|
||||
"END_FUNCTION", reader.Location );
|
||||
ExpFunctionSource _source = new ExpFunctionSource(
|
||||
match.Groups[ "FunctionName" ].ToString(), transmitter );
|
||||
transmitter.WriteLine( match.Groups[ "Remaining" ].ToString() );
|
||||
@@ -254,7 +228,7 @@ namespace StgSharp.Script.Express
|
||||
Match match = _ruleDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_RULE", reader.Location);
|
||||
"END_RULE", reader.Location );
|
||||
ExpRuleSource _source = new ExpRuleSource(
|
||||
match.Groups[ "RuleName" ].ToString(), transmitter );
|
||||
string target = match.Groups[ "Target" ].ToString();
|
||||
@@ -289,7 +263,7 @@ namespace StgSharp.Script.Express
|
||||
Match match = _typeDefineBegin.Match( firstLine );
|
||||
if( match.Success ) {
|
||||
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
|
||||
"END_ENTITY", reader.Location);
|
||||
"END_ENTITY", reader.Location );
|
||||
ExpTypeSource _source = new ExpTypeSource(
|
||||
match.Groups[ "TypeName" ].ToString(), transmitter );
|
||||
transmitter.WriteLine( match.Groups[ "Remaining" ].ToString() );
|
||||
@@ -313,11 +287,37 @@ namespace StgSharp.Script.Express
|
||||
return false;
|
||||
}
|
||||
|
||||
[GeneratedRegex(@"\s*CONSTANT")]
|
||||
private static partial Regex GetConstDefineBegin();
|
||||
private static Regex
|
||||
_constDefineBegin = GetConstDefineBegin(),
|
||||
_constDefineEnd = GetConstDefineEnd(),
|
||||
_schemaBegin = GetSchemaBegin(),
|
||||
_schemaEnd = new Regex(
|
||||
@"END_SCHEMA;\s*--\s*(?<namespace>[A-Za-z0-9_]+)",
|
||||
RegexOptions.Compiled ),
|
||||
_entityDefineBegin = new Regex(
|
||||
@"\s*ENTITY\s*(?<TypeName>[A-Za-z0-9_]+)\s*",
|
||||
RegexOptions.Compiled ),
|
||||
_entityDefineEnd = new Regex(
|
||||
@"\s*END_ENTITY;\s*--\s*(?<TypeName>[A-Za-z0-9_]+)\s*",
|
||||
RegexOptions.Compiled ),
|
||||
_typeDefineBegin = new Regex(
|
||||
@"\s*TYPE\s+(?<TypeName>[A-Za-z0-9_]+)\s*=\s*(?<Remaining>[A-Z]+)",
|
||||
RegexOptions.Compiled ),
|
||||
_typeDefineEnd = new Regex(
|
||||
@"\s*END_TYPE\s*;\s*--\s*(?<TypeName>[a-zA-Z0-9_]+)",
|
||||
RegexOptions.Compiled ),
|
||||
_functionDefineBegin = new Regex(
|
||||
@"\s*FUNCTION\s*\s*(?<FunctionName>[a-zA-Z0-9_]+)\s*(?<Remaining>.*)",
|
||||
RegexOptions.Compiled ),
|
||||
_functionDefineEnd = new Regex(
|
||||
@"\s*END_FUNCTION\s*;\s*--\s*(?<FunctionName>[a-zA-Z0-9_]+)",
|
||||
RegexOptions.Compiled ),
|
||||
_ruleDefineBegin = new Regex(
|
||||
@"\s*RULE\s*(?<RuleName>[a-zA-Z0-9_]+)\s*FOR\s*\((?<Target>[a-zA-Z0-9_]*(\s*\)\s*;)?)",
|
||||
RegexOptions.Compiled ),
|
||||
_ruleDefineEnd = new Regex(
|
||||
@"\s*END_RULE\s*;\s*--\s*(?<RuleName>[A-Za-z0-9_]+)",
|
||||
RegexOptions.Compiled );
|
||||
|
||||
[GeneratedRegex(@"\s*SCHEMA\s*(?<namespace>[A-Za-z0-9_]+)\s?;")]
|
||||
private static partial Regex GetSchemaBegin();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user