mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-28 02:35:32 +08:00
Update release
This commit is contained in:
@@ -489,7 +489,7 @@ WindowsDirect2DParagraph (Initialization)
|
||||
textLayout->SetMaxWidth(65536);
|
||||
textLayout->SetWordWrapping(DWRITE_WORD_WRAPPING_WRAP);
|
||||
}
|
||||
graphicsElements.Add(TextRange(0, _text.Length()), 0);
|
||||
graphicsElements.Add(TextRange(0, _text.Length()), nullptr);
|
||||
backgroundColors.Add(TextRange(0, _text.Length()), Color(0, 0, 0, 0));
|
||||
|
||||
GetWindowsDirect2DResourceManager()->DestroyDirect2DTextFormat(defaultFont);
|
||||
@@ -10719,7 +10719,9 @@ OS Supporting
|
||||
|
||||
IWindowsDirect2DRenderTarget* GetBindedRenderTarget(INativeWindow* window)override
|
||||
{
|
||||
return dynamic_cast<IWindowsDirect2DRenderTarget*>(vl::presentation::windows::GetWindowsForm(window)->GetGraphicsHandler());
|
||||
auto windowsForm = vl::presentation::windows::GetWindowsForm(window);
|
||||
auto graphicsHandler = windowsForm->GetGraphicsHandler();
|
||||
return dynamic_cast<IWindowsDirect2DRenderTarget*>(graphicsHandler);
|
||||
}
|
||||
|
||||
void SetBindedRenderTarget(INativeWindow* window, IWindowsDirect2DRenderTarget* renderTarget)override
|
||||
@@ -13254,7 +13256,6 @@ namespace vl
|
||||
{
|
||||
namespace windows
|
||||
{
|
||||
using namespace parsing::xml;
|
||||
using namespace collections;
|
||||
|
||||
/***********************************************************************
|
||||
|
||||
@@ -3,7 +3,7 @@ THIS FILE IS AUTOMATICALLY GENERATED. DO NOT MODIFY
|
||||
DEVELOPER: Zihan Chen(vczh)
|
||||
***********************************************************************/
|
||||
#include "GacUI.h"
|
||||
#include "VlppParser.h"
|
||||
#include "VlppGlrParser.h"
|
||||
#include "VlppWorkflowLibrary.h"
|
||||
#include "VlppReflection.h"
|
||||
#include "VlppOS.h"
|
||||
|
||||
+70
-85
@@ -17,9 +17,7 @@ namespace vl
|
||||
{
|
||||
namespace description
|
||||
{
|
||||
using namespace parsing;
|
||||
using namespace parsing::tabling;
|
||||
using namespace parsing::xml;
|
||||
using namespace glr::xml;
|
||||
using namespace stream;
|
||||
using namespace collections;
|
||||
using namespace presentation;
|
||||
@@ -23331,7 +23329,6 @@ namespace vl
|
||||
using namespace collections;
|
||||
using namespace compositions;
|
||||
using namespace regex;
|
||||
using namespace parsing;
|
||||
|
||||
/***********************************************************************
|
||||
GuiToolstripCommand
|
||||
@@ -23383,7 +23380,7 @@ GuiToolstripCommand
|
||||
|
||||
void GuiToolstripCommand::BuildShortcut(const WString& builderText)
|
||||
{
|
||||
List<Ptr<ParsingError>> errors;
|
||||
List<glr::ParsingError> errors;
|
||||
if (auto parser = GetParserManager()->GetParser<ShortcutBuilder>(L"SHORTCUT"))
|
||||
{
|
||||
if (Ptr<ShortcutBuilder> builder = parser->ParseInternal(builderText, errors))
|
||||
@@ -23607,12 +23604,12 @@ GuiToolstripCommand::ShortcutBuilder Parser
|
||||
{
|
||||
}
|
||||
|
||||
Ptr<ShortcutBuilder> ParseInternal(const WString& text, collections::List<Ptr<ParsingError>>& errors)override
|
||||
Ptr<ShortcutBuilder> ParseInternal(const WString& text, collections::List<glr::ParsingError>& errors)override
|
||||
{
|
||||
Ptr<RegexMatch> match=regexShortcut.MatchHead(text);
|
||||
if (match && match->Result().Length() != text.Length())
|
||||
{
|
||||
errors.Add(new ParsingError(L"Failed to parse a shortcut \"" + text + L"\"."));
|
||||
errors.Add(glr::ParsingError(nullptr, {}, L"Failed to parse a shortcut \"" + text + L"\"."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33397,8 +33394,7 @@ namespace vl
|
||||
namespace presentation
|
||||
{
|
||||
using namespace collections;
|
||||
using namespace parsing::tabling;
|
||||
using namespace parsing::xml;
|
||||
using namespace glr::xml;
|
||||
using namespace regex;
|
||||
using namespace stream;
|
||||
|
||||
@@ -33761,7 +33757,7 @@ namespace vl
|
||||
namespace presentation
|
||||
{
|
||||
using namespace collections;
|
||||
using namespace parsing::xml;
|
||||
using namespace glr::xml;
|
||||
using namespace stream;
|
||||
|
||||
namespace document_clipboard_visitors
|
||||
@@ -37414,8 +37410,7 @@ namespace vl
|
||||
namespace presentation
|
||||
{
|
||||
using namespace collections;
|
||||
using namespace parsing::tabling;
|
||||
using namespace parsing::xml;
|
||||
using namespace glr::xml;
|
||||
using namespace regex;
|
||||
|
||||
/***********************************************************************
|
||||
@@ -37463,10 +37458,6 @@ document_operation_visitors::DeserializeNodeVisitor
|
||||
PrintText(node->content.value);
|
||||
}
|
||||
|
||||
void Visit(XmlAttribute* node)override
|
||||
{
|
||||
}
|
||||
|
||||
void Visit(XmlComment* node)override
|
||||
{
|
||||
}
|
||||
@@ -37806,7 +37797,7 @@ document_operation_visitors::DeserializeNodeVisitor
|
||||
DocumentModel
|
||||
***********************************************************************/
|
||||
|
||||
Ptr<DocumentModel> DocumentModel::LoadFromXml(Ptr<GuiResourceItem> resource, Ptr<parsing::xml::XmlDocument> xml, Ptr<GuiResourcePathResolver> resolver, GuiResourceError::List& errors)
|
||||
Ptr<DocumentModel> DocumentModel::LoadFromXml(Ptr<GuiResourceItem> resource, Ptr<glr::xml::XmlDocument> xml, Ptr<GuiResourcePathResolver> resolver, GuiResourceError::List& errors)
|
||||
{
|
||||
Ptr<DocumentModel> model = new DocumentModel;
|
||||
if (xml->rootElement->name.value == L"Doc")
|
||||
@@ -37918,7 +37909,7 @@ namespace vl
|
||||
namespace presentation
|
||||
{
|
||||
using namespace collections;
|
||||
using namespace parsing::xml;
|
||||
using namespace glr::xml;
|
||||
|
||||
/***********************************************************************
|
||||
document_operation_visitors::SerializeRunVisitor
|
||||
@@ -38178,7 +38169,7 @@ document_operation_visitors::SerializeRunVisitor
|
||||
DocumentModel
|
||||
***********************************************************************/
|
||||
|
||||
Ptr<parsing::xml::XmlDocument> DocumentModel::SaveToXml()
|
||||
Ptr<glr::xml::XmlDocument> DocumentModel::SaveToXml()
|
||||
{
|
||||
Ptr<XmlDocument> xml=new XmlDocument;
|
||||
Ptr<XmlElement> doc=new XmlElement;
|
||||
@@ -38259,9 +38250,8 @@ namespace vl
|
||||
{
|
||||
using namespace collections;
|
||||
using namespace controls;
|
||||
using namespace parsing::tabling;
|
||||
using namespace parsing::xml;
|
||||
using namespace parsing::json;
|
||||
using namespace glr::xml;
|
||||
using namespace glr::json;
|
||||
using namespace regex;
|
||||
|
||||
/***********************************************************************
|
||||
@@ -38275,11 +38265,39 @@ IGuiParserManager
|
||||
return parserManager;
|
||||
}
|
||||
|
||||
class GuiParser_Xml : public IGuiParser<XmlDocument>
|
||||
{
|
||||
protected:
|
||||
glr::xml::Parser parser;
|
||||
|
||||
public:
|
||||
Ptr<XmlDocument> ParseInternal(const WString& text, List<glr::ParsingError>& errors) override
|
||||
{
|
||||
auto handler = glr::InstallDefaultErrorMessageGenerator(parser, errors);
|
||||
auto ast = XmlParseDocument(text, parser);
|
||||
parser.OnError.Remove(handler);
|
||||
return ast;
|
||||
}
|
||||
};
|
||||
|
||||
class GuiParser_Json : public IGuiParser<JsonNode>
|
||||
{
|
||||
protected:
|
||||
glr::json::Parser parser;
|
||||
|
||||
public:
|
||||
Ptr<JsonNode> ParseInternal(const WString& text, List<glr::ParsingError>& errors) override
|
||||
{
|
||||
auto handler = glr::InstallDefaultErrorMessageGenerator(parser, errors);
|
||||
auto ast = JsonParse(text, parser);
|
||||
parser.OnError.Remove(handler);
|
||||
return ast;
|
||||
}
|
||||
};
|
||||
|
||||
class GuiParserManager : public Object, public IGuiParserManager, public IGuiPlugin
|
||||
{
|
||||
protected:
|
||||
Dictionary<WString, Ptr<Table>> tables;
|
||||
Dictionary<WString, Func<Ptr<Table>()>> loaders;
|
||||
SpinLock lock;
|
||||
|
||||
Dictionary<WString, Ptr<IGuiGeneralParser>> parsers;
|
||||
@@ -38291,11 +38309,9 @@ IGuiParserManager
|
||||
|
||||
void Load()override
|
||||
{
|
||||
parserManager=this;
|
||||
SetParsingTable(L"XML", &XmlLoadTable);
|
||||
SetParsingTable(L"JSON", &JsonLoadTable);
|
||||
SetTableParser(L"XML", L"XML", &XmlParseDocument);
|
||||
SetTableParser(L"JSON", L"JSON", &JsonParse);
|
||||
parserManager = this;
|
||||
SetParser(L"XML", new GuiParser_Xml());
|
||||
SetParser(L"JSON", new GuiParser_Json());
|
||||
}
|
||||
|
||||
void Unload()override
|
||||
@@ -38303,34 +38319,6 @@ IGuiParserManager
|
||||
parserManager=0;
|
||||
}
|
||||
|
||||
Ptr<Table> GetParsingTable(const WString& name)override
|
||||
{
|
||||
SPIN_LOCK(lock)
|
||||
{
|
||||
vint index=tables.Keys().IndexOf(name);
|
||||
if(index!=-1)
|
||||
{
|
||||
return tables.Values()[index];
|
||||
}
|
||||
|
||||
index=loaders.Keys().IndexOf(name);
|
||||
if(index!=-1)
|
||||
{
|
||||
Ptr<Table> table=loaders.Values()[index]();
|
||||
tables.Add(name, table);
|
||||
return table;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool SetParsingTable(const WString& name, Func<Ptr<Table>()> loader)override
|
||||
{
|
||||
if(loaders.Keys().Contains(name)) return false;
|
||||
loaders.Add(name, loader);
|
||||
return true;
|
||||
}
|
||||
|
||||
Ptr<IGuiGeneralParser> GetParser(const WString& name)override
|
||||
{
|
||||
vint index=parsers.Keys().IndexOf(name);
|
||||
@@ -38358,8 +38346,7 @@ namespace vl
|
||||
{
|
||||
using namespace controls;
|
||||
using namespace collections;
|
||||
using namespace parsing;
|
||||
using namespace parsing::xml;
|
||||
using namespace glr::xml;
|
||||
using namespace stream;
|
||||
using namespace filesystem;
|
||||
|
||||
@@ -38647,7 +38634,7 @@ GuiResourceLocation
|
||||
GuiResourceTextPos
|
||||
***********************************************************************/
|
||||
|
||||
GuiResourceTextPos::GuiResourceTextPos(GuiResourceLocation location, parsing::ParsingTextPos position)
|
||||
GuiResourceTextPos::GuiResourceTextPos(GuiResourceLocation location, glr::ParsingTextPos position)
|
||||
:originalLocation(location)
|
||||
, row(position.row)
|
||||
, column(position.column)
|
||||
@@ -38680,7 +38667,7 @@ GuiResourceError
|
||||
}
|
||||
|
||||
template<typename TCallback>
|
||||
void TransformErrors(GuiResourceError::List& errors, collections::List<Ptr<parsing::ParsingError>>& parsingErrors, GuiResourceTextPos offset, const TCallback& callback)
|
||||
void TransformErrors(GuiResourceError::List& errors, collections::List<glr::ParsingError>& parsingErrors, GuiResourceTextPos offset, const TCallback& callback)
|
||||
{
|
||||
if (offset.row < 0 || offset.column < 0)
|
||||
{
|
||||
@@ -38690,7 +38677,7 @@ GuiResourceError
|
||||
|
||||
for (auto error : parsingErrors)
|
||||
{
|
||||
auto pos = error->codeRange.start;
|
||||
auto pos = error.codeRange.start;
|
||||
if (pos.row < 0 || pos.column < 0)
|
||||
{
|
||||
pos = { offset.row,offset.column };
|
||||
@@ -38703,21 +38690,21 @@ GuiResourceError
|
||||
}
|
||||
pos.row += offset.row;
|
||||
}
|
||||
errors.Add(callback({ offset.originalLocation,pos }, error->errorMessage));
|
||||
errors.Add(callback({ offset.originalLocation,pos }, error.message));
|
||||
}
|
||||
}
|
||||
|
||||
void GuiResourceError::Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<Ptr<parsing::ParsingError>>& parsingErrors)
|
||||
void GuiResourceError::Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<glr::ParsingError>& parsingErrors)
|
||||
{
|
||||
Transform(_location, errors, parsingErrors, { _location,{ 0,0 } });
|
||||
}
|
||||
|
||||
void GuiResourceError::Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<Ptr<parsing::ParsingError>>& parsingErrors, parsing::ParsingTextPos offset)
|
||||
void GuiResourceError::Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<glr::ParsingError>& parsingErrors, glr::ParsingTextPos offset)
|
||||
{
|
||||
Transform(_location, errors, parsingErrors, { _location,offset });
|
||||
}
|
||||
|
||||
void GuiResourceError::Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<Ptr<parsing::ParsingError>>& parsingErrors, GuiResourceTextPos offset)
|
||||
void GuiResourceError::Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<glr::ParsingError>& parsingErrors, GuiResourceTextPos offset)
|
||||
{
|
||||
TransformErrors(errors, parsingErrors, offset, [&](GuiResourceTextPos pos, const WString& message)
|
||||
{
|
||||
@@ -38816,7 +38803,7 @@ GuiResourceItem
|
||||
return content.Cast<GuiImageData>();
|
||||
}
|
||||
|
||||
Ptr<parsing::xml::XmlDocument> GuiResourceItem::AsXml()
|
||||
Ptr<glr::xml::XmlDocument> GuiResourceItem::AsXml()
|
||||
{
|
||||
return content.Cast<XmlDocument>();
|
||||
}
|
||||
@@ -38835,7 +38822,7 @@ GuiResourceItem
|
||||
GuiResourceFolder
|
||||
***********************************************************************/
|
||||
|
||||
void GuiResourceFolder::LoadResourceFolderFromXml(DelayLoadingList& delayLoadings, const WString& containingFolder, Ptr<parsing::xml::XmlElement> folderXml, GuiResourceError::List& errors)
|
||||
void GuiResourceFolder::LoadResourceFolderFromXml(DelayLoadingList& delayLoadings, const WString& containingFolder, Ptr<glr::xml::XmlElement> folderXml, GuiResourceError::List& errors)
|
||||
{
|
||||
ClearItems();
|
||||
ClearFolders();
|
||||
@@ -39011,7 +38998,7 @@ GuiResourceFolder
|
||||
}
|
||||
}
|
||||
|
||||
void GuiResourceFolder::SaveResourceFolderToXml(Ptr<parsing::xml::XmlElement> xmlParent)
|
||||
void GuiResourceFolder::SaveResourceFolderToXml(Ptr<glr::xml::XmlElement> xmlParent)
|
||||
{
|
||||
for (auto item : items.Values())
|
||||
{
|
||||
@@ -39548,7 +39535,7 @@ GuiResourceFolder
|
||||
GuiResourceMetadata
|
||||
***********************************************************************/
|
||||
|
||||
void GuiResourceMetadata::LoadFromXml(Ptr<parsing::xml::XmlDocument> xml, GuiResourceLocation location, GuiResourceError::List& errors)
|
||||
void GuiResourceMetadata::LoadFromXml(Ptr<glr::xml::XmlDocument> xml, GuiResourceLocation location, GuiResourceError::List& errors)
|
||||
{
|
||||
auto attrName = XmlGetAttribute(xml->rootElement, L"Name");
|
||||
auto attrVersion = XmlGetAttribute(xml->rootElement, L"Version");
|
||||
@@ -39575,7 +39562,7 @@ GuiResourceMetadata
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<parsing::xml::XmlDocument> GuiResourceMetadata::SaveToXml()
|
||||
Ptr<glr::xml::XmlDocument> GuiResourceMetadata::SaveToXml()
|
||||
{
|
||||
auto root = MakePtr<XmlElement>();
|
||||
root->name.value = L"ResourceMetadata";
|
||||
@@ -39675,7 +39662,7 @@ GuiResource
|
||||
return workingDirectory;
|
||||
}
|
||||
|
||||
Ptr<GuiResource> GuiResource::LoadFromXml(Ptr<parsing::xml::XmlDocument> xml, const WString& filePath, const WString& workingDirectory, GuiResourceError::List& errors)
|
||||
Ptr<GuiResource> GuiResource::LoadFromXml(Ptr<glr::xml::XmlDocument> xml, const WString& filePath, const WString& workingDirectory, GuiResourceError::List& errors)
|
||||
{
|
||||
Ptr<GuiResource> resource = new GuiResource;
|
||||
resource->SetFileContentPath(filePath, filePath);
|
||||
@@ -39709,7 +39696,7 @@ GuiResource
|
||||
return 0;
|
||||
}
|
||||
|
||||
Ptr<parsing::xml::XmlDocument> GuiResource::SaveToXml()
|
||||
Ptr<glr::xml::XmlDocument> GuiResource::SaveToXml()
|
||||
{
|
||||
auto xmlRoot = MakePtr<XmlElement>();
|
||||
xmlRoot->name.value = L"Resource";
|
||||
@@ -39865,7 +39852,7 @@ GuiResource
|
||||
return result;
|
||||
}
|
||||
|
||||
Ptr<parsing::xml::XmlDocument> GuiResource::GetXmlByPath(const WString& path)
|
||||
Ptr<glr::xml::XmlDocument> GuiResource::GetXmlByPath(const WString& path)
|
||||
{
|
||||
Ptr<XmlDocument> result=GetValueByPath(path).Cast<XmlDocument>();
|
||||
if(!result) throw ArgumentException(L"Path not exists.", L"GuiResource::GetXmlByPath", L"path");
|
||||
@@ -40185,7 +40172,7 @@ Helpers
|
||||
{
|
||||
for (vint i = 0; i < rows; i++)
|
||||
{
|
||||
vint size = i == rows - 1 ? remain : block;
|
||||
vint size = (i == rows - 1 && remain > 0) ? remain : block;
|
||||
outputStream.Write((void*)buffer[i], size);
|
||||
}
|
||||
}
|
||||
@@ -40204,7 +40191,7 @@ namespace vl
|
||||
{
|
||||
using namespace collections;
|
||||
using namespace stream;
|
||||
using namespace parsing::xml;
|
||||
using namespace glr::xml;
|
||||
using namespace reflection::description;
|
||||
using namespace controls;
|
||||
|
||||
@@ -40470,9 +40457,7 @@ namespace vl
|
||||
{
|
||||
using namespace collections;
|
||||
using namespace controls;
|
||||
using namespace parsing;
|
||||
using namespace parsing::tabling;
|
||||
using namespace parsing::xml;
|
||||
using namespace glr::xml;
|
||||
using namespace stream;
|
||||
|
||||
/***********************************************************************
|
||||
@@ -40511,7 +40496,7 @@ Image Type Resolver (Image)
|
||||
return this;
|
||||
}
|
||||
|
||||
Ptr<parsing::xml::XmlElement> Serialize(Ptr<GuiResourceItem> resource, Ptr<DescriptableObject> content)override
|
||||
Ptr<glr::xml::XmlElement> Serialize(Ptr<GuiResourceItem> resource, Ptr<DescriptableObject> content)override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -40524,7 +40509,7 @@ Image Type Resolver (Image)
|
||||
writer << (stream::IStream&)fileStream;
|
||||
}
|
||||
|
||||
Ptr<DescriptableObject> ResolveResource(Ptr<GuiResourceItem> resource, Ptr<parsing::xml::XmlElement> element, GuiResourceError::List& errors)override
|
||||
Ptr<DescriptableObject> ResolveResource(Ptr<GuiResourceItem> resource, Ptr<glr::xml::XmlElement> element, GuiResourceError::List& errors)override
|
||||
{
|
||||
errors.Add(GuiResourceError({ resource }, L"Image should load from file."));
|
||||
return nullptr;
|
||||
@@ -40599,7 +40584,7 @@ Text Type Resolver (Text)
|
||||
return this;
|
||||
}
|
||||
|
||||
Ptr<parsing::xml::XmlElement> Serialize(Ptr<GuiResourceItem> resource, Ptr<DescriptableObject> content)override
|
||||
Ptr<glr::xml::XmlElement> Serialize(Ptr<GuiResourceItem> resource, Ptr<DescriptableObject> content)override
|
||||
{
|
||||
if (auto obj = content.Cast<GuiTextData>())
|
||||
{
|
||||
@@ -40623,7 +40608,7 @@ Text Type Resolver (Text)
|
||||
writer << text;
|
||||
}
|
||||
|
||||
Ptr<DescriptableObject> ResolveResource(Ptr<GuiResourceItem> resource, Ptr<parsing::xml::XmlElement> element, GuiResourceError::List& errors)override
|
||||
Ptr<DescriptableObject> ResolveResource(Ptr<GuiResourceItem> resource, Ptr<glr::xml::XmlElement> element, GuiResourceError::List& errors)override
|
||||
{
|
||||
return new GuiTextData(XmlGetValue(element));
|
||||
}
|
||||
@@ -40687,7 +40672,7 @@ Xml Type Resolver (Xml)
|
||||
return this;
|
||||
}
|
||||
|
||||
Ptr<parsing::xml::XmlElement> Serialize(Ptr<GuiResourceItem> resource, Ptr<DescriptableObject> content)override
|
||||
Ptr<glr::xml::XmlElement> Serialize(Ptr<GuiResourceItem> resource, Ptr<DescriptableObject> content)override
|
||||
{
|
||||
if (auto obj = content.Cast<XmlDocument>())
|
||||
{
|
||||
@@ -40710,7 +40695,7 @@ Xml Type Resolver (Xml)
|
||||
writer << text;
|
||||
}
|
||||
|
||||
Ptr<DescriptableObject> ResolveResource(Ptr<GuiResourceItem> resource, Ptr<parsing::xml::XmlElement> element, GuiResourceError::List& errors)override
|
||||
Ptr<DescriptableObject> ResolveResource(Ptr<GuiResourceItem> resource, Ptr<glr::xml::XmlElement> element, GuiResourceError::List& errors)override
|
||||
{
|
||||
Ptr<XmlElement> root = XmlGetElements(element).First(0);
|
||||
if(root)
|
||||
|
||||
+22
-85
@@ -2,12 +2,13 @@
|
||||
THIS FILE IS AUTOMATICALLY GENERATED. DO NOT MODIFY
|
||||
DEVELOPER: Zihan Chen(vczh)
|
||||
***********************************************************************/
|
||||
#include "VlppParser.h"
|
||||
#include "VlppGlrParser.h"
|
||||
#include "VlppWorkflowLibrary.h"
|
||||
#include "VlppReflection.h"
|
||||
#include "VlppOS.h"
|
||||
#include "Vlpp.h"
|
||||
#include "VlppRegex.h"
|
||||
#include "VlppParser.h"
|
||||
|
||||
/***********************************************************************
|
||||
.\GUITYPES.H
|
||||
@@ -6505,11 +6506,11 @@ Resource Structure
|
||||
struct GuiResourceTextPos
|
||||
{
|
||||
GuiResourceLocation originalLocation;
|
||||
vint row = parsing::ParsingTextPos::UnknownValue;
|
||||
vint column = parsing::ParsingTextPos::UnknownValue;
|
||||
vint row = glr::ParsingTextPos::UnknownValue;
|
||||
vint column = glr::ParsingTextPos::UnknownValue;
|
||||
|
||||
GuiResourceTextPos() = default;
|
||||
GuiResourceTextPos(GuiResourceLocation location, parsing::ParsingTextPos position);
|
||||
GuiResourceTextPos(GuiResourceLocation location, glr::ParsingTextPos position);
|
||||
|
||||
bool operator==(const GuiResourceTextPos& b)const { return originalLocation == b.originalLocation && row == b.row && column == b.column; }
|
||||
bool operator!=(const GuiResourceTextPos& b)const { return !(*this == b); }
|
||||
@@ -6532,9 +6533,9 @@ Resource Structure
|
||||
bool operator==(const GuiResourceError& b)const { return location == b.location && position == b.position && message == b.message; }
|
||||
bool operator!=(const GuiResourceError& b)const { return !(*this == b); }
|
||||
|
||||
static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<Ptr<parsing::ParsingError>>& parsingErrors);
|
||||
static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<Ptr<parsing::ParsingError>>& parsingErrors, parsing::ParsingTextPos offset);
|
||||
static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<Ptr<parsing::ParsingError>>& parsingErrors, GuiResourceTextPos offset);
|
||||
static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<glr::ParsingError>& parsingErrors);
|
||||
static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<glr::ParsingError>& parsingErrors, glr::ParsingTextPos offset);
|
||||
static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<glr::ParsingError>& parsingErrors, GuiResourceTextPos offset);
|
||||
static void SortAndLog(List& errors, collections::List<WString>& output, const WString& workingDirectory = WString::Empty);
|
||||
};
|
||||
|
||||
@@ -6574,7 +6575,7 @@ Resource Structure
|
||||
Ptr<GuiImageData> AsImage();
|
||||
/// <summary>Get the contained object as an xml.</summary>
|
||||
/// <returns>The contained object.</returns>
|
||||
Ptr<parsing::xml::XmlDocument> AsXml();
|
||||
Ptr<glr::xml::XmlDocument> AsXml();
|
||||
/// <summary>Get the contained object as a string.</summary>
|
||||
/// <returns>The contained object.</returns>
|
||||
Ptr<GuiTextData> AsString();
|
||||
@@ -6605,8 +6606,8 @@ Resource Structure
|
||||
ItemMap items;
|
||||
FolderMap folders;
|
||||
|
||||
void LoadResourceFolderFromXml(DelayLoadingList& delayLoadings, const WString& containingFolder, Ptr<parsing::xml::XmlElement> folderXml, GuiResourceError::List& errors);
|
||||
void SaveResourceFolderToXml(Ptr<parsing::xml::XmlElement> xmlParent);
|
||||
void LoadResourceFolderFromXml(DelayLoadingList& delayLoadings, const WString& containingFolder, Ptr<glr::xml::XmlElement> folderXml, GuiResourceError::List& errors);
|
||||
void SaveResourceFolderToXml(Ptr<glr::xml::XmlElement> xmlParent);
|
||||
void CollectTypeNames(collections::List<WString>& typeNames);
|
||||
void LoadResourceFolderFromBinary(DelayLoadingList& delayLoadings, stream::internal::ContextFreeReader& reader, collections::List<WString>& typeNames, GuiResourceError::List& errors);
|
||||
void SaveResourceFolderToBinary(stream::internal::ContextFreeWriter& writer, collections::List<WString>& typeNames);
|
||||
@@ -6697,8 +6698,8 @@ Resource
|
||||
WString version;
|
||||
collections::List<WString> dependencies;
|
||||
|
||||
void LoadFromXml(Ptr<parsing::xml::XmlDocument> xml, GuiResourceLocation location, GuiResourceError::List& errors);
|
||||
Ptr<parsing::xml::XmlDocument> SaveToXml();
|
||||
void LoadFromXml(Ptr<glr::xml::XmlDocument> xml, GuiResourceLocation location, GuiResourceError::List& errors);
|
||||
Ptr<glr::xml::XmlDocument> SaveToXml();
|
||||
};
|
||||
|
||||
/// <summary>Resource. A resource is a root resource folder that does not have a name.</summary>
|
||||
@@ -6730,7 +6731,7 @@ Resource
|
||||
/// <param name="filePath">The file path of the resource.</param>
|
||||
/// <param name="workingDirectory">The working directory for loading external resources.</param>
|
||||
/// <param name="errors">All collected errors during loading a resource.</param>
|
||||
static Ptr<GuiResource> LoadFromXml(Ptr<parsing::xml::XmlDocument> xml, const WString& filePath, const WString& workingDirectory, GuiResourceError::List& errors);
|
||||
static Ptr<GuiResource> LoadFromXml(Ptr<glr::xml::XmlDocument> xml, const WString& filePath, const WString& workingDirectory, GuiResourceError::List& errors);
|
||||
|
||||
/// <summary>Load a resource from an xml file. If the xml file refers other files, they will be loaded as well.</summary>
|
||||
/// <returns>The loaded resource.</returns>
|
||||
@@ -6740,7 +6741,7 @@ Resource
|
||||
|
||||
/// <summary>Save the resource to xml.</summary>
|
||||
/// <returns>The xml.</returns>
|
||||
Ptr<parsing::xml::XmlDocument> SaveToXml();
|
||||
Ptr<glr::xml::XmlDocument> SaveToXml();
|
||||
|
||||
/// <summary>Load a precompiled resource from a stream.</summary>
|
||||
/// <returns>The loaded resource.</returns>
|
||||
@@ -6779,7 +6780,7 @@ Resource
|
||||
/// <summary>Get a contained xml using a path like "Packages\Application\Name". If the path does not exists or the type does not match, an exception will be thrown.</summary>
|
||||
/// <returns>The containd resource object.</returns>
|
||||
/// <param name="path">The path.</param>
|
||||
Ptr<parsing::xml::XmlDocument> GetXmlByPath(const WString& path);
|
||||
Ptr<glr::xml::XmlDocument> GetXmlByPath(const WString& path);
|
||||
/// <summary>Get a contained string object using a path like "Packages\Application\Name". If the path does not exists or the type does not match, an exception will be thrown.</summary>
|
||||
/// <returns>The containd resource object.</returns>
|
||||
/// <param name="path">The path.</param>
|
||||
@@ -6997,14 +6998,14 @@ Resource Type Resolver
|
||||
/// <returns>The serialized xml element.</returns>
|
||||
/// <param name="resource">The resource item containing the resource.</param>
|
||||
/// <param name="content">The object to serialize.</param>
|
||||
virtual Ptr<parsing::xml::XmlElement> Serialize(Ptr<GuiResourceItem> resource, Ptr<DescriptableObject> content) = 0;
|
||||
virtual Ptr<glr::xml::XmlElement> Serialize(Ptr<GuiResourceItem> resource, Ptr<DescriptableObject> content) = 0;
|
||||
|
||||
/// <summary>Load a resource for a type inside an xml element.</summary>
|
||||
/// <returns>The resource.</returns>
|
||||
/// <param name="resource">The resource item containing the resource.</param>
|
||||
/// <param name="element">The xml element.</param>
|
||||
/// <param name="errors">All collected errors during loading a resource.</param>
|
||||
virtual Ptr<DescriptableObject> ResolveResource(Ptr<GuiResourceItem> resource, Ptr<parsing::xml::XmlElement> element, GuiResourceError::List& errors) = 0;
|
||||
virtual Ptr<DescriptableObject> ResolveResource(Ptr<GuiResourceItem> resource, Ptr<glr::xml::XmlElement> element, GuiResourceError::List& errors) = 0;
|
||||
|
||||
/// <summary>Load a resource for a type from a file.</summary>
|
||||
/// <returns>The resource.</returns>
|
||||
@@ -7801,11 +7802,11 @@ Rich Content Document (model)
|
||||
/// <param name="xml">The xml document.</param>
|
||||
/// <param name="resolver">A document resolver to resolve symbols in non-embedded objects like image.</param>
|
||||
/// <param name="errors">All collected errors during loading a resource.</param>
|
||||
static Ptr<DocumentModel> LoadFromXml(Ptr<GuiResourceItem> resource, Ptr<parsing::xml::XmlDocument> xml, Ptr<GuiResourcePathResolver> resolver, GuiResourceError::List& errors);
|
||||
static Ptr<DocumentModel> LoadFromXml(Ptr<GuiResourceItem> resource, Ptr<glr::xml::XmlDocument> xml, Ptr<GuiResourcePathResolver> resolver, GuiResourceError::List& errors);
|
||||
|
||||
/// <summary>Save a document model to an xml.</summary>
|
||||
/// <returns>The saved xml document.</returns>
|
||||
Ptr<parsing::xml::XmlDocument> SaveToXml();
|
||||
Ptr<glr::xml::XmlDocument> SaveToXml();
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -19566,7 +19567,7 @@ Parser
|
||||
template<typename T>
|
||||
class IGuiParser : public IGuiGeneralParser
|
||||
{
|
||||
using ErrorList = collections::List<Ptr<parsing::ParsingError>>;
|
||||
using ErrorList = collections::List<glr::ParsingError>;
|
||||
public:
|
||||
virtual Ptr<T> ParseInternal(const WString& text, ErrorList& errors) = 0;
|
||||
|
||||
@@ -19578,7 +19579,7 @@ Parser
|
||||
return result;
|
||||
}
|
||||
|
||||
Ptr<T> Parse(GuiResourceLocation location, const WString& text, parsing::ParsingTextPos position, collections::List<GuiResourceError>& errors)
|
||||
Ptr<T> Parse(GuiResourceLocation location, const WString& text, glr::ParsingTextPos position, collections::List<GuiResourceError>& errors)
|
||||
{
|
||||
ErrorList parsingErrors;
|
||||
auto result = ParseInternal(text, parsingErrors);
|
||||
@@ -19602,19 +19603,7 @@ Parser Manager
|
||||
/// <summary>Parser manager for caching parsing table globally.</summary>
|
||||
class IGuiParserManager : public IDescriptable, public Description<IGuiParserManager>
|
||||
{
|
||||
protected:
|
||||
typedef parsing::tabling::ParsingTable Table;
|
||||
|
||||
public:
|
||||
/// <summary>Get a parsing table by name.</summary>
|
||||
/// <returns>The parsing table.</returns>
|
||||
/// <param name="name">The name.</param>
|
||||
virtual Ptr<Table> GetParsingTable(const WString& name)=0;
|
||||
/// <summary>Set a parsing table loader by name.</summary>
|
||||
/// <returns>Returns true if this operation succeeded.</returns>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="loader">The parsing table loader.</param>
|
||||
virtual bool SetParsingTable(const WString& name, Func<Ptr<Table>()> loader)=0;
|
||||
/// <summary>Get a parser.</summary>
|
||||
/// <returns>The parser.</returns>
|
||||
/// <param name="name">The name.</param>
|
||||
@@ -19627,57 +19616,12 @@ Parser Manager
|
||||
|
||||
template<typename T>
|
||||
Ptr<IGuiParser<T>> GetParser(const WString& name);
|
||||
|
||||
template<typename T>
|
||||
bool SetTableParser(const WString& tableName, const WString& parserName, Ptr<T>(*function)(const WString&, Ptr<Table>, collections::List<Ptr<parsing::ParsingError>>&, vint));
|
||||
};
|
||||
|
||||
/// <summary>Get the global <see cref="IGuiParserManager"/> object.</summary>
|
||||
/// <returns>The parser manager.</returns>
|
||||
extern IGuiParserManager* GetParserManager();
|
||||
|
||||
/***********************************************************************
|
||||
Strong Typed Table Parser
|
||||
***********************************************************************/
|
||||
|
||||
template<typename T>
|
||||
class GuiStrongTypedTableParser : public Object, public IGuiParser<T>
|
||||
{
|
||||
protected:
|
||||
typedef parsing::tabling::ParsingTable Table;
|
||||
typedef Ptr<T>(ParserFunction)(const WString&, Ptr<Table>, collections::List<Ptr<parsing::ParsingError>>&, vint);
|
||||
protected:
|
||||
WString name;
|
||||
Ptr<Table> table;
|
||||
Func<ParserFunction> function;
|
||||
|
||||
public:
|
||||
GuiStrongTypedTableParser(const WString& _name, ParserFunction* _function)
|
||||
:name(_name)
|
||||
,function(_function)
|
||||
{
|
||||
}
|
||||
|
||||
Ptr<T> ParseInternal(const WString& text, collections::List<Ptr<parsing::ParsingError>>& errors)override
|
||||
{
|
||||
if (!table)
|
||||
{
|
||||
table = GetParserManager()->GetParsingTable(name);
|
||||
}
|
||||
if (table)
|
||||
{
|
||||
collections::List<Ptr<parsing::ParsingError>> parsingErrors;
|
||||
auto result = function(text, table, parsingErrors, -1);
|
||||
if (parsingErrors.Count() > 0)
|
||||
{
|
||||
errors.Add(parsingErrors[0]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
Parser Manager
|
||||
***********************************************************************/
|
||||
@@ -19687,13 +19631,6 @@ Parser Manager
|
||||
{
|
||||
return GetParser(name).Cast<IGuiParser<T>>();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool IGuiParserManager::SetTableParser(const WString& tableName, const WString& parserName, Ptr<T>(*function)(const WString&, Ptr<Table>, collections::List<Ptr<parsing::ParsingError>>&, vint))
|
||||
{
|
||||
Ptr<IGuiParser<T>> parser=new GuiStrongTypedTableParser<T>(tableName, function);
|
||||
return SetParser(parserName, parser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+676
-537
File diff suppressed because one or more lines are too long
+277
-189
File diff suppressed because it is too large
Load Diff
@@ -237,7 +237,7 @@ namespace vl
|
||||
{
|
||||
namespace description
|
||||
{
|
||||
using namespace parsing::xml;
|
||||
using namespace glr::xml;
|
||||
using namespace presentation;
|
||||
using namespace helper_types;
|
||||
|
||||
@@ -3457,9 +3457,9 @@ namespace vl
|
||||
void Load()override
|
||||
{
|
||||
LoadPredefinedTypes();
|
||||
LoadParsingTypes();
|
||||
XmlLoadTypes();
|
||||
JsonLoadTypes();
|
||||
LoadParsing2Types();
|
||||
XmlAstLoadTypes();
|
||||
JsonAstLoadTypes();
|
||||
WfLoadLibraryTypes();
|
||||
LoadGuiBasicTypes();
|
||||
LoadGuiElementTypes();
|
||||
|
||||
@@ -4,7 +4,7 @@ DEVELOPER: Zihan Chen(vczh)
|
||||
***********************************************************************/
|
||||
#include "GacUI.h"
|
||||
#include "VlppWorkflowCompiler.h"
|
||||
#include "VlppParser.h"
|
||||
#include "VlppGlrParser.h"
|
||||
#include "VlppWorkflowLibrary.h"
|
||||
#include "VlppReflection.h"
|
||||
#include "VlppOS.h"
|
||||
|
||||
@@ -3,7 +3,7 @@ THIS FILE IS AUTOMATICALLY GENERATED. DO NOT MODIFY
|
||||
DEVELOPER: Zihan Chen(vczh)
|
||||
***********************************************************************/
|
||||
#include "GacUI.h"
|
||||
#include "VlppParser.h"
|
||||
#include "VlppGlrParser.h"
|
||||
#include "VlppWorkflowLibrary.h"
|
||||
#include "VlppReflection.h"
|
||||
#include "VlppOS.h"
|
||||
|
||||
@@ -5,7 +5,7 @@ DEVELOPER: Zihan Chen(vczh)
|
||||
#include "DarkSkin.h"
|
||||
#include "GacUIReflection.h"
|
||||
#include "GacUI.h"
|
||||
#include "VlppParser.h"
|
||||
#include "VlppGlrParser.h"
|
||||
#include "VlppWorkflowLibrary.h"
|
||||
#include "VlppReflection.h"
|
||||
#include "VlppOS.h"
|
||||
|
||||
+657
-340
File diff suppressed because it is too large
Load Diff
+26
-26
@@ -1409,15 +1409,15 @@ namespace vl
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonNode, system::json::JsonNode)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonNode::IVisitor, system::json::JsonNode::IVisitor)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonLiteralValue, system::json::JsonLiteralValue)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonLiteral, system::json::JsonLiteral)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonString, system::json::JsonString)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonNumber, system::json::JsonNumber)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonArray, system::json::JsonArray)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonObjectField, system::json::JsonObjectField)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonObject, system::json::JsonObject)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonNode, system::JsonNode)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonNode::IVisitor, system::JsonNode::IVisitor)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonLiteralValue, system::JsonLiteralValue)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonLiteral, system::JsonLiteral)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonString, system::JsonString)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonNumber, system::JsonNumber)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonArray, system::JsonArray)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonObjectField, system::JsonObjectField)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::json::JsonObject, system::JsonObject)
|
||||
|
||||
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
|
||||
|
||||
@@ -2235,7 +2235,7 @@ namespace vl
|
||||
}
|
||||
|
||||
Parser::Parser()
|
||||
: vl::glr::ParserBase<JsonTokens, ParserStates, JsonAstInsReceiver, ParserStateTypes>(&JsonTokenDeleter, &JsonLexerData, &JsonParserData)
|
||||
: vl::glr::ParserBase<JsonTokens, ParserStates, JsonAstInsReceiver>(&JsonTokenDeleter, &JsonLexerData, &JsonParserData)
|
||||
{
|
||||
};
|
||||
|
||||
@@ -2246,12 +2246,12 @@ namespace vl
|
||||
|
||||
vl::Ptr<vl::glr::json::JsonNode> Parser::ParseJRoot(const vl::WString& input, vl::vint codeIndex) const
|
||||
{
|
||||
return Parse<ParserStates::JRoot>(input, this, codeIndex);
|
||||
return ParseWithString<vl::glr::json::JsonNode, ParserStates::JRoot>(input, this, codeIndex);
|
||||
};
|
||||
|
||||
vl::Ptr<vl::glr::json::JsonNode> Parser::ParseJRoot(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
|
||||
{
|
||||
return Parse<ParserStates::JRoot>(tokens, this, codeIndex);
|
||||
return ParseWithTokens<vl::glr::json::JsonNode, ParserStates::JRoot>(tokens, this, codeIndex);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5405,15 +5405,15 @@ namespace vl
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlNode, system::xml::XmlNode)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlNode::IVisitor, system::xml::XmlNode::IVisitor)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlText, system::xml::XmlText)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlCData, system::xml::XmlCData)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlAttribute, system::xml::XmlAttribute)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlComment, system::xml::XmlComment)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlElement, system::xml::XmlElement)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlInstruction, system::xml::XmlInstruction)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlDocument, system::xml::XmlDocument)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlNode, system::XmlNode)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlNode::IVisitor, system::XmlNode::IVisitor)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlText, system::XmlText)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlCData, system::XmlCData)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlAttribute, system::XmlAttribute)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlComment, system::XmlComment)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlElement, system::XmlElement)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlInstruction, system::XmlInstruction)
|
||||
IMPL_TYPE_INFO_RENAME(vl::glr::xml::XmlDocument, system::XmlDocument)
|
||||
|
||||
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
|
||||
|
||||
@@ -6390,7 +6390,7 @@ namespace vl
|
||||
}
|
||||
|
||||
Parser::Parser()
|
||||
: vl::glr::ParserBase<XmlTokens, ParserStates, XmlAstInsReceiver, ParserStateTypes>(&XmlTokenDeleter, &XmlLexerData, &XmlParserData)
|
||||
: vl::glr::ParserBase<XmlTokens, ParserStates, XmlAstInsReceiver>(&XmlTokenDeleter, &XmlLexerData, &XmlParserData)
|
||||
{
|
||||
};
|
||||
|
||||
@@ -6401,22 +6401,22 @@ namespace vl
|
||||
|
||||
vl::Ptr<vl::glr::xml::XmlElement> Parser::ParseXElement(const vl::WString& input, vl::vint codeIndex) const
|
||||
{
|
||||
return Parse<ParserStates::XElement>(input, this, codeIndex);
|
||||
return ParseWithString<vl::glr::xml::XmlElement, ParserStates::XElement>(input, this, codeIndex);
|
||||
};
|
||||
|
||||
vl::Ptr<vl::glr::xml::XmlElement> Parser::ParseXElement(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
|
||||
{
|
||||
return Parse<ParserStates::XElement>(tokens, this, codeIndex);
|
||||
return ParseWithTokens<vl::glr::xml::XmlElement, ParserStates::XElement>(tokens, this, codeIndex);
|
||||
};
|
||||
|
||||
vl::Ptr<vl::glr::xml::XmlDocument> Parser::ParseXDocument(const vl::WString& input, vl::vint codeIndex) const
|
||||
{
|
||||
return Parse<ParserStates::XDocument>(input, this, codeIndex);
|
||||
return ParseWithString<vl::glr::xml::XmlDocument, ParserStates::XDocument>(input, this, codeIndex);
|
||||
};
|
||||
|
||||
vl::Ptr<vl::glr::xml::XmlDocument> Parser::ParseXDocument(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
|
||||
{
|
||||
return Parse<ParserStates::XDocument>(tokens, this, codeIndex);
|
||||
return ParseWithTokens<vl::glr::xml::XmlDocument, ParserStates::XDocument>(tokens, this, codeIndex);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+23
-26
@@ -1275,8 +1275,7 @@ ParserBase<TTokens, TStates, TReceiver, TStateTypes>
|
||||
template<
|
||||
typename TTokens,
|
||||
typename TStates,
|
||||
typename TReceiver,
|
||||
template<TStates> class TStateTypes
|
||||
typename TReceiver
|
||||
>
|
||||
class ParserBase : public Object
|
||||
{
|
||||
@@ -1329,12 +1328,13 @@ ParserBase<TTokens, TStates, TReceiver, TStateTypes>
|
||||
|
||||
void Tokenize(const WString& input, TokenList& tokens, vint codeIndex = -1) const
|
||||
{
|
||||
input.Buffer();
|
||||
auto enumerable = lexer->Parse(input, {}, codeIndex);
|
||||
Ptr<collections::IEnumerator<regex::RegexToken>> enumerator = enumerable.CreateEnumerator();
|
||||
while (enumerator->Next())
|
||||
{
|
||||
auto&& token = enumerator->Current();
|
||||
if (token.token == -1)
|
||||
if (token.token == -1 || !token.completeToken)
|
||||
{
|
||||
auto args = ErrorArgs::UnrecognizedToken(token);
|
||||
args.throwError = false;
|
||||
@@ -1352,17 +1352,15 @@ ParserBase<TTokens, TStates, TReceiver, TStateTypes>
|
||||
}
|
||||
|
||||
protected:
|
||||
template<TStates State>
|
||||
auto Parse(TokenList& tokens, const automaton::TraceManager::ITypeCallback* typeCallback, vint codeIndex) const -> Ptr<typename TStateTypes<State>::Type>
|
||||
Ptr<ParsingAstBase> ParseInternal(TokenList& tokens, vint32_t state, automaton::TraceManager& tm, const automaton::TraceManager::ITypeCallback* typeCallback, vint codeIndex) const
|
||||
{
|
||||
#define ERROR_MESSAGE_PREFIX L"vl::glr::ParserBase<...>::Parse<TStates>(List<RegexToken>&, TraceManager::ITypeCallback*)#"
|
||||
#define ERROR_MESSAGE_PREFIX L"vl::glr::ParserBase<...>::ParseInternal(List<RegexToken>&, vint32_t TraceManager::ITypeCallback*)#"
|
||||
if (codeIndex == -1 && tokens.Count() > 0)
|
||||
{
|
||||
codeIndex = tokens[0].codeIndex;
|
||||
}
|
||||
|
||||
automaton::TraceManager tm(*executable.Obj(), typeCallback);
|
||||
tm.Initialize((vint32_t)State);
|
||||
tm.Initialize(state);
|
||||
for (vint32_t i = 0; i < tokens.Count(); i++)
|
||||
{
|
||||
auto&& token = tokens[i];
|
||||
@@ -1394,27 +1392,35 @@ ParserBase<TTokens, TStates, TReceiver, TStateTypes>
|
||||
}
|
||||
|
||||
TReceiver receiver;
|
||||
auto ast = tm.ExecuteTrace(rootTrace, receiver, tokens);
|
||||
auto typedAst = ast.Cast<typename TStateTypes<State>::Type>();
|
||||
return tm.ExecuteTrace(rootTrace, receiver, tokens);
|
||||
|
||||
#undef ERROR_MESSAGE_PREFIX
|
||||
}
|
||||
|
||||
template<typename TAst, TStates State>
|
||||
Ptr<TAst> ParseWithTokens(TokenList& tokens, const automaton::TraceManager::ITypeCallback* typeCallback, vint codeIndex) const
|
||||
{
|
||||
#define ERROR_MESSAGE_PREFIX L"vl::glr::ParserBase<...>::Parse<TAst, TStates>(List<RegexToken>& TraceManager::ITypeCallback*)#"
|
||||
automaton::TraceManager tm(*executable.Obj(), typeCallback);
|
||||
auto ast = ParseInternal(tokens, (vint32_t)State, tm, typeCallback, codeIndex);
|
||||
auto typedAst = ast.Cast<TAst>();
|
||||
|
||||
if (!typedAst)
|
||||
{
|
||||
auto args = ErrorArgs::UnexpectedAstType(tokens, *executable.Obj(), tm, ast);
|
||||
OnError(args);
|
||||
if (args.throwError) CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unexpected type of the created AST.");
|
||||
return nullptr;
|
||||
}
|
||||
return typedAst;
|
||||
|
||||
#undef ERROR_MESSAGE_PREFIX
|
||||
}
|
||||
|
||||
template<TStates State>
|
||||
auto Parse(const WString& input, const automaton::TraceManager::ITypeCallback* typeCallback, vint codeIndex) const
|
||||
template<typename TAst, TStates State>
|
||||
Ptr<TAst> ParseWithString(const WString& input, const automaton::TraceManager::ITypeCallback* typeCallback, vint codeIndex) const
|
||||
{
|
||||
TokenList tokens;
|
||||
Tokenize(input, tokens, codeIndex);
|
||||
return Parse<State>(tokens, typeCallback, codeIndex);
|
||||
return ParseWithTokens<TAst, State>(tokens, typeCallback, codeIndex);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1999,16 +2005,12 @@ namespace vl
|
||||
JRoot = 29,
|
||||
};
|
||||
|
||||
template<ParserStates> struct ParserStateTypes;
|
||||
template<> struct ParserStateTypes<ParserStates::JRoot> { using Type = vl::glr::json::JsonNode; };
|
||||
|
||||
const wchar_t* ParserRuleName(vl::vint index);
|
||||
const wchar_t* ParserStateLabel(vl::vint index);
|
||||
extern void JsonParserData(vl::stream::IStream& outputStream);
|
||||
|
||||
class Parser
|
||||
: public vl::glr::ParserBase<JsonTokens, ParserStates, JsonAstInsReceiver, ParserStateTypes>
|
||||
, protected vl::glr::automaton::TraceManager::ITypeCallback
|
||||
: public vl::glr::ParserBase<JsonTokens, ParserStates, JsonAstInsReceiver> , protected vl::glr::automaton::TraceManager::ITypeCallback
|
||||
{
|
||||
protected:
|
||||
vl::vint32_t FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const override;
|
||||
@@ -2683,17 +2685,12 @@ namespace vl
|
||||
XDocument = 40,
|
||||
};
|
||||
|
||||
template<ParserStates> struct ParserStateTypes;
|
||||
template<> struct ParserStateTypes<ParserStates::XElement> { using Type = vl::glr::xml::XmlElement; };
|
||||
template<> struct ParserStateTypes<ParserStates::XDocument> { using Type = vl::glr::xml::XmlDocument; };
|
||||
|
||||
const wchar_t* ParserRuleName(vl::vint index);
|
||||
const wchar_t* ParserStateLabel(vl::vint index);
|
||||
extern void XmlParserData(vl::stream::IStream& outputStream);
|
||||
|
||||
class Parser
|
||||
: public vl::glr::ParserBase<XmlTokens, ParserStates, XmlAstInsReceiver, ParserStateTypes>
|
||||
, protected vl::glr::automaton::TraceManager::ITypeCallback
|
||||
: public vl::glr::ParserBase<XmlTokens, ParserStates, XmlAstInsReceiver> , protected vl::glr::automaton::TraceManager::ITypeCallback
|
||||
{
|
||||
protected:
|
||||
vl::vint32_t FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const override;
|
||||
|
||||
@@ -7337,7 +7337,7 @@ namespace vl
|
||||
}
|
||||
|
||||
RuleParser::RuleParser()
|
||||
: vl::glr::ParserBase<ParserGenTokens, RuleParserStates, ParserGenAstInsReceiver, RuleParserStateTypes>(&ParserGenTokenDeleter, &ParserGenLexerData, &ParserGenRuleParserData)
|
||||
: vl::glr::ParserBase<ParserGenTokens, RuleParserStates, ParserGenAstInsReceiver>(&ParserGenTokenDeleter, &ParserGenLexerData, &ParserGenRuleParserData)
|
||||
{
|
||||
};
|
||||
|
||||
@@ -7348,12 +7348,12 @@ namespace vl
|
||||
|
||||
vl::Ptr<vl::glr::parsergen::GlrSyntaxFile> RuleParser::ParseFile(const vl::WString& input, vl::vint codeIndex) const
|
||||
{
|
||||
return Parse<RuleParserStates::File>(input, this, codeIndex);
|
||||
return ParseWithString<vl::glr::parsergen::GlrSyntaxFile, RuleParserStates::File>(input, this, codeIndex);
|
||||
};
|
||||
|
||||
vl::Ptr<vl::glr::parsergen::GlrSyntaxFile> RuleParser::ParseFile(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
|
||||
{
|
||||
return Parse<RuleParserStates::File>(tokens, this, codeIndex);
|
||||
return ParseWithTokens<vl::glr::parsergen::GlrSyntaxFile, RuleParserStates::File>(tokens, this, codeIndex);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -8245,7 +8245,7 @@ namespace vl
|
||||
}
|
||||
|
||||
TypeParser::TypeParser()
|
||||
: vl::glr::ParserBase<ParserGenTokens, TypeParserStates, ParserGenAstInsReceiver, TypeParserStateTypes>(&ParserGenTokenDeleter, &ParserGenLexerData, &ParserGenTypeParserData)
|
||||
: vl::glr::ParserBase<ParserGenTokens, TypeParserStates, ParserGenAstInsReceiver>(&ParserGenTokenDeleter, &ParserGenLexerData, &ParserGenTypeParserData)
|
||||
{
|
||||
};
|
||||
|
||||
@@ -8256,12 +8256,12 @@ namespace vl
|
||||
|
||||
vl::Ptr<vl::glr::parsergen::GlrAstFile> TypeParser::ParseFile(const vl::WString& input, vl::vint codeIndex) const
|
||||
{
|
||||
return Parse<TypeParserStates::File>(input, this, codeIndex);
|
||||
return ParseWithString<vl::glr::parsergen::GlrAstFile, TypeParserStates::File>(input, this, codeIndex);
|
||||
};
|
||||
|
||||
vl::Ptr<vl::glr::parsergen::GlrAstFile> TypeParser::ParseFile(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
|
||||
{
|
||||
return Parse<TypeParserStates::File>(tokens, this, codeIndex);
|
||||
return ParseWithTokens<vl::glr::parsergen::GlrAstFile, TypeParserStates::File>(tokens, this, codeIndex);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -8801,19 +8801,6 @@ WriteSyntaxHeaderFile
|
||||
}
|
||||
writer.WriteLine(prefix + L"};");
|
||||
}
|
||||
{
|
||||
writer.WriteLine(L"");
|
||||
writer.WriteLine(prefix + L"template<" + manager.name + L"States> struct " + manager.name + L"StateTypes;");
|
||||
for(auto ruleName : manager.RuleOrder())
|
||||
{
|
||||
auto ruleSymbol = manager.Rules()[ruleName];
|
||||
if (manager.parsableRules.Contains(ruleSymbol))
|
||||
{
|
||||
auto astType = manager.ruleTypes[ruleSymbol];
|
||||
writer.WriteLine(prefix + L"template<> struct " + manager.name + L"StateTypes<" + manager.name + L"States::" + ruleName + L"> { using Type = " + astType + L"; };");
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
writer.WriteLine(L"");
|
||||
writer.WriteLine(prefix + L"const wchar_t* " + manager.name + L"RuleName(vl::vint index);");
|
||||
@@ -8826,8 +8813,7 @@ WriteSyntaxHeaderFile
|
||||
writer.WriteString(prefix+L"\t: public vl::glr::ParserBase<");
|
||||
writer.WriteString(manager.Global().name + L"Tokens, ");
|
||||
writer.WriteString(manager.name + L"States, ");
|
||||
writer.WriteString(manager.Global().name + L"AstInsReceiver, ");
|
||||
writer.WriteLine(manager.name + L"StateTypes>");
|
||||
writer.WriteString(manager.Global().name + L"AstInsReceiver>");
|
||||
writer.WriteLine(prefix + L"\t, protected vl::glr::automaton::TraceManager::ITypeCallback");
|
||||
writer.WriteLine(prefix + L"{");
|
||||
writer.WriteLine(prefix + L"protected:");
|
||||
@@ -8907,8 +8893,7 @@ WriteSyntaxCppFile
|
||||
writer.WriteString(prefix + L"\t: vl::glr::ParserBase<");
|
||||
writer.WriteString(manager.Global().name + L"Tokens, ");
|
||||
writer.WriteString(manager.name + L"States, ");
|
||||
writer.WriteString(manager.Global().name + L"AstInsReceiver, ");
|
||||
writer.WriteString(manager.name + L"StateTypes>(");
|
||||
writer.WriteString(manager.Global().name + L"AstInsReceiver>(");
|
||||
writer.WriteString(L"&" + manager.Global().name + L"TokenDeleter, ");
|
||||
writer.WriteString(L"&" + manager.Global().name + L"LexerData, ");
|
||||
writer.WriteLine(L"&" + manager.Global().name + manager.name + L"Data)");
|
||||
@@ -8969,12 +8954,12 @@ WriteSyntaxCppFile
|
||||
writer.WriteLine(L"");
|
||||
writer.WriteLine(prefix + L"vl::Ptr<" + astType + L"> " + manager.name + L"::Parse" + ruleName + L"(const vl::WString& input, vl::vint codeIndex) const");
|
||||
writer.WriteLine(prefix + L"{");
|
||||
writer.WriteLine(prefix + L"\t return Parse<" + manager.name + L"States::" + ruleName + L">(input, this, codeIndex);");
|
||||
writer.WriteLine(prefix + L"\t return ParseWithString<" + astType + L", " + manager.name + L"States::" + ruleName + L">(input, this, codeIndex);");
|
||||
writer.WriteLine(prefix + L"};");
|
||||
writer.WriteLine(L"");
|
||||
writer.WriteLine(prefix + L"vl::Ptr<" + astType + L"> " + manager.name + L"::Parse" + ruleName + L"(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const");
|
||||
writer.WriteLine(prefix + L"{");
|
||||
writer.WriteLine(prefix + L"\t return Parse<" + manager.name + L"States::" + ruleName + L">(tokens, this, codeIndex);");
|
||||
writer.WriteLine(prefix + L"\t return ParseWithTokens<" + astType + L", " + manager.name + L"States::" + ruleName + L">(tokens, this, codeIndex);");
|
||||
writer.WriteLine(prefix + L"};");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1934,16 +1934,12 @@ namespace vl
|
||||
File = 73,
|
||||
};
|
||||
|
||||
template<RuleParserStates> struct RuleParserStateTypes;
|
||||
template<> struct RuleParserStateTypes<RuleParserStates::File> { using Type = vl::glr::parsergen::GlrSyntaxFile; };
|
||||
|
||||
const wchar_t* RuleParserRuleName(vl::vint index);
|
||||
const wchar_t* RuleParserStateLabel(vl::vint index);
|
||||
extern void ParserGenRuleParserData(vl::stream::IStream& outputStream);
|
||||
|
||||
class RuleParser
|
||||
: public vl::glr::ParserBase<ParserGenTokens, RuleParserStates, ParserGenAstInsReceiver, RuleParserStateTypes>
|
||||
, protected vl::glr::automaton::TraceManager::ITypeCallback
|
||||
: public vl::glr::ParserBase<ParserGenTokens, RuleParserStates, ParserGenAstInsReceiver> , protected vl::glr::automaton::TraceManager::ITypeCallback
|
||||
{
|
||||
protected:
|
||||
vl::vint32_t FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const override;
|
||||
@@ -1989,16 +1985,12 @@ namespace vl
|
||||
File = 44,
|
||||
};
|
||||
|
||||
template<TypeParserStates> struct TypeParserStateTypes;
|
||||
template<> struct TypeParserStateTypes<TypeParserStates::File> { using Type = vl::glr::parsergen::GlrAstFile; };
|
||||
|
||||
const wchar_t* TypeParserRuleName(vl::vint index);
|
||||
const wchar_t* TypeParserStateLabel(vl::vint index);
|
||||
extern void ParserGenTypeParserData(vl::stream::IStream& outputStream);
|
||||
|
||||
class TypeParser
|
||||
: public vl::glr::ParserBase<ParserGenTokens, TypeParserStates, ParserGenAstInsReceiver, TypeParserStateTypes>
|
||||
, protected vl::glr::automaton::TraceManager::ITypeCallback
|
||||
: public vl::glr::ParserBase<ParserGenTokens, TypeParserStates, ParserGenAstInsReceiver> , protected vl::glr::automaton::TraceManager::ITypeCallback
|
||||
{
|
||||
protected:
|
||||
vl::vint32_t FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const override;
|
||||
|
||||
@@ -438,7 +438,7 @@ Utilities
|
||||
{
|
||||
acceptTypes.Add(request.acceptTypes.Get(i).Buffer());
|
||||
}
|
||||
acceptTypes.Add(0);
|
||||
acceptTypes.Add(nullptr);
|
||||
requestInternet = WinHttpOpenRequest(connectedInternet, request.method.Buffer(), request.query.Buffer(), NULL, WINHTTP_NO_REFERER, &acceptTypes[0], (request.secure ? WINHTTP_FLAG_SECURE : 0));
|
||||
error = GetLastError();
|
||||
if (!requestInternet) goto CLEANUP;
|
||||
|
||||
+1
-1
@@ -2491,7 +2491,7 @@ LzwDecoder
|
||||
}
|
||||
if (eofIndex != -1)
|
||||
{
|
||||
dictionary.Add(0);
|
||||
dictionary.Add(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6204,23 +6204,23 @@ Containers
|
||||
Ptr<TValueItf> ChooseValueCollectionFromNonDictionaryEnumerable(const collections::IEnumerable<T>* enumerable)
|
||||
{
|
||||
auto writable = const_cast<Object*>(enumerable->GetCollectionObject());
|
||||
if (auto xs = dynamic_cast<collections::ObservableList<T>*>(writable))
|
||||
if (auto xs = dynamic_cast<collections::ObservableList<std::remove_cvref_t<T>>*>(writable))
|
||||
{
|
||||
return GetValueCollectionFromCollection<IValueObservableList, TValueItf, ValueObservableListWrapper>(xs);
|
||||
}
|
||||
else if (auto xs = dynamic_cast<collections::ObservableListBase<T>*>(writable))
|
||||
else if (auto xs = dynamic_cast<collections::ObservableListBase<std::remove_cvref_t<T>>*>(writable))
|
||||
{
|
||||
return GetValueCollectionFromCollection<IValueList, TValueItf, ValueListWrapper>(xs);
|
||||
}
|
||||
else if (auto xs = dynamic_cast<collections::List<T>*>(writable))
|
||||
else if (auto xs = dynamic_cast<collections::List<std::remove_cvref_t<T>>*>(writable))
|
||||
{
|
||||
return GetValueCollectionFromCollection<IValueList, TValueItf, ValueListWrapper>(xs);
|
||||
}
|
||||
else if (auto xs = dynamic_cast<collections::Array<T>*>(writable))
|
||||
else if (auto xs = dynamic_cast<collections::Array<std::remove_cvref_t<T>>*>(writable))
|
||||
{
|
||||
return GetValueCollectionFromCollection<IValueArray, TValueItf, ValueArrayWrapper>(xs);
|
||||
}
|
||||
else if (auto xs = dynamic_cast<collections::SortedList<T>*>(writable))
|
||||
else if (auto xs = dynamic_cast<collections::SortedList<std::remove_cvref_t<T>>*>(writable))
|
||||
{
|
||||
return GetValueCollectionFromCollection<IValueReadonlyList, TValueItf, ValueReadonlyListWrapper>(xs);
|
||||
}
|
||||
@@ -6240,7 +6240,7 @@ Containers
|
||||
Ptr<TValueItf> ChooseValueCollectionFromEnumerable(const collections::IEnumerable<collections::Pair<K, V>>* enumerable)
|
||||
{
|
||||
auto writable = const_cast<Object*>(enumerable->GetCollectionObject());
|
||||
if (auto xs = dynamic_cast<collections::Dictionary<K, V>*>(writable))
|
||||
if (auto xs = dynamic_cast<collections::Dictionary<std::remove_cvref_t<K>, std::remove_cvref_t<V>>*>(writable))
|
||||
{
|
||||
return GetValueCollectionFromCollection<IValueDictionary, TValueItf, ValueDictionaryWrapper>(xs);
|
||||
}
|
||||
|
||||
+267
-82
@@ -15,6 +15,14 @@ Licensed under https://github.com/vczh-libraries/License
|
||||
|
||||
namespace vl
|
||||
{
|
||||
namespace regex_internal
|
||||
{
|
||||
void ReadInt(stream::IStream& inputStream, vint& value);
|
||||
void ReadInts(stream::IStream& inputStream, vint count, vint* values);
|
||||
void WriteInt(stream::IStream& outputStream, vint value);
|
||||
void WriteInts(stream::IStream& outputStream, vint count, vint* values);
|
||||
}
|
||||
|
||||
namespace regex
|
||||
{
|
||||
using namespace collections;
|
||||
@@ -916,6 +924,7 @@ RegexLexerBase_
|
||||
template<typename T>
|
||||
RegexTokens_<T> RegexLexerBase_::Parse(const ObjectString<T>& code, RegexProc_<T> proc, vint codeIndex)const
|
||||
{
|
||||
code.Buffer();
|
||||
pure->PrepareForRelatedFinalStateTable();
|
||||
return RegexTokens_<T>(pure, stateTokens, code, codeIndex, proc);
|
||||
}
|
||||
@@ -939,6 +948,34 @@ RegexLexerBase_
|
||||
return RegexLexerColorizer_<T>(Walk<T>(), proc);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
RegexLexer_<T> (Serialization)
|
||||
***********************************************************************/
|
||||
|
||||
template<typename T>
|
||||
RegexLexer_<T>::RegexLexer_(stream::IStream& inputStream)
|
||||
{
|
||||
pure = new PureInterpretor(inputStream);
|
||||
vint count = 0;
|
||||
ReadInt(inputStream, count);
|
||||
stateTokens.Resize(count);
|
||||
if (count > 0)
|
||||
{
|
||||
ReadInts(inputStream, count, &stateTokens[0]);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void RegexLexer_<T>::Serialize(stream::IStream& outputStream)
|
||||
{
|
||||
pure->Serialize(outputStream);
|
||||
WriteInt(outputStream, stateTokens.Count());
|
||||
if (stateTokens.Count() > 0)
|
||||
{
|
||||
WriteInts(outputStream, stateTokens.Count(), &stateTokens[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
RegexLexer_<T>
|
||||
***********************************************************************/
|
||||
@@ -990,8 +1027,8 @@ RegexLexer_<T>
|
||||
Automaton::Ref bigEnfa = new Automaton;
|
||||
for (vint i = 0; i < dfas.Count(); i++)
|
||||
{
|
||||
CopyFrom(bigEnfa->states, dfas[i]->states);
|
||||
CopyFrom(bigEnfa->transitions, dfas[i]->transitions);
|
||||
CopyFrom(bigEnfa->states, dfas[i]->states, true);
|
||||
CopyFrom(bigEnfa->transitions, dfas[i]->transitions, true);
|
||||
}
|
||||
bigEnfa->startState = bigEnfa->NewState();
|
||||
for (vint i = 0; i < dfas.Count(); i++)
|
||||
@@ -1135,43 +1172,209 @@ namespace vl
|
||||
{
|
||||
namespace regex_internal
|
||||
{
|
||||
using namespace collections;
|
||||
|
||||
/***********************************************************************
|
||||
Read
|
||||
***********************************************************************/
|
||||
|
||||
void ReadInt(stream::IStream& inputStream, vint& value)
|
||||
{
|
||||
#ifdef VCZH_64
|
||||
vint32_t x = 0;
|
||||
CHECK_ERROR(
|
||||
inputStream.Read(&x, sizeof(vint32_t)) == sizeof(vint32_t),
|
||||
L"Failed to deserialize RegexLexer."
|
||||
);
|
||||
value = (vint)x;
|
||||
#else
|
||||
CHECK_ERROR(
|
||||
inputStream.Read(&value, sizeof(vint32_t)) == sizeof(vint32_t),
|
||||
L"Failed to deserialize RegexLexer."
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ReadInts(stream::IStream& inputStream, vint count, vint* values)
|
||||
{
|
||||
#ifdef VCZH_64
|
||||
Array<vint32_t> xs(count);
|
||||
CHECK_ERROR(
|
||||
inputStream.Read(&xs[0], sizeof(vint32_t) * count) == sizeof(vint32_t) * count,
|
||||
L"Failed to deserialize RegexLexer."
|
||||
);
|
||||
for (vint i = 0; i < count; i++)
|
||||
{
|
||||
values[i] = (vint)xs[i];
|
||||
}
|
||||
#else
|
||||
CHECK_ERROR(
|
||||
inputStream.Read(values, sizeof(vint32_t) * count) == sizeof(vint32_t) * count,
|
||||
L"Failed to deserialize RegexLexer."
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ReadBools(stream::IStream& inputStream, vint count, bool* values)
|
||||
{
|
||||
Array<vuint8_t> bits((count + 7) / 8);
|
||||
CHECK_ERROR(
|
||||
inputStream.Read(&bits[0], sizeof(vuint8_t) * bits.Count()) == sizeof(vuint8_t) * bits.Count(),
|
||||
L"Failed to deserialize RegexLexer."
|
||||
);
|
||||
|
||||
for (vint i = 0; i < count; i++)
|
||||
{
|
||||
vint x = i / 8;
|
||||
vint y = i % 8;
|
||||
values[i] = ((bits[x] >> y) & 1) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Write
|
||||
***********************************************************************/
|
||||
|
||||
void WriteInt(stream::IStream& outputStream, vint value)
|
||||
{
|
||||
#ifdef VCZH_64
|
||||
vint32_t x = (vint32_t)value;
|
||||
CHECK_ERROR(
|
||||
outputStream.Write(&x, sizeof(vint32_t)) == sizeof(vint32_t),
|
||||
L"Failed to serialize RegexLexer."
|
||||
);
|
||||
#else
|
||||
CHECK_ERROR(
|
||||
outputStream.Write(&value, sizeof(vint32_t)) == sizeof(vint32_t),
|
||||
L"Failed to serialize RegexLexer."
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
void WriteInts(stream::IStream& outputStream, vint count, vint* values)
|
||||
{
|
||||
#ifdef VCZH_64
|
||||
Array<vint32_t> xs(count);
|
||||
for (vint i = 0; i < count; i++)
|
||||
{
|
||||
xs[i] = (vint32_t)values[i];
|
||||
}
|
||||
CHECK_ERROR(
|
||||
outputStream.Write(&xs[0], sizeof(vint32_t) * count) == sizeof(vint32_t) * count,
|
||||
L"Failed to serialize RegexLexer."
|
||||
);
|
||||
#else
|
||||
CHECK_ERROR(
|
||||
outputStream.Write(values, sizeof(vint32_t) * count) == sizeof(vint32_t) * count,
|
||||
L"Failed to serialize RegexLexer."
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
void WriteBools(stream::IStream& outputStream, vint count, bool* values)
|
||||
{
|
||||
Array<vuint8_t> bits((count + 7) / 8);
|
||||
memset(&bits[0], 0, sizeof(vuint8_t) * bits.Count());
|
||||
|
||||
for (vint i = 0; i < count; i++)
|
||||
{
|
||||
if (values[i])
|
||||
{
|
||||
vint x = i / 8;
|
||||
vint y = i % 8;
|
||||
bits[x] |= (vuint8_t)1 << y;
|
||||
}
|
||||
}
|
||||
|
||||
CHECK_ERROR(
|
||||
outputStream.Write(&bits[0], sizeof(vuint8_t) * bits.Count()) == sizeof(vuint8_t) * bits.Count(),
|
||||
L"Failed to serialize RegexLexer."
|
||||
);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
PureInterpretor (Serialization)
|
||||
***********************************************************************/
|
||||
|
||||
PureInterpretor::PureInterpretor(stream::IStream& inputStream)
|
||||
{
|
||||
ReadInt(inputStream, stateCount);
|
||||
ReadInt(inputStream, charSetCount);
|
||||
ReadInt(inputStream, startState);
|
||||
{
|
||||
vint count = 0;
|
||||
ReadInt(inputStream, count);
|
||||
charRanges.Resize(count);
|
||||
if (count > 0)
|
||||
{
|
||||
vint size = charRanges.Count() * sizeof(CharRange);
|
||||
CHECK_ERROR(inputStream.Read(&charRanges[0], size) == size, L"Failed to serialize RegexLexer.");
|
||||
}
|
||||
ExpandCharRanges();
|
||||
}
|
||||
|
||||
transitions = new vint[stateCount * charSetCount];
|
||||
ReadInts(inputStream, stateCount * charSetCount, transitions);
|
||||
|
||||
finalState = new bool[stateCount];
|
||||
ReadBools(inputStream, stateCount, finalState);
|
||||
}
|
||||
|
||||
void PureInterpretor::Serialize(stream::IStream& outputStream)
|
||||
{
|
||||
WriteInt(outputStream, stateCount);
|
||||
WriteInt(outputStream, charSetCount);
|
||||
WriteInt(outputStream, startState);
|
||||
{
|
||||
WriteInt(outputStream, charRanges.Count());
|
||||
if (charRanges.Count() > 0)
|
||||
{
|
||||
vint size = charRanges.Count() * sizeof(CharRange);
|
||||
CHECK_ERROR(outputStream.Write(&charRanges[0], size) == size, L"Failed to serialize RegexLexer.");
|
||||
}
|
||||
}
|
||||
WriteInts(outputStream, stateCount * charSetCount, transitions);
|
||||
WriteBools(outputStream, stateCount, finalState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
PureInterpretor
|
||||
***********************************************************************/
|
||||
|
||||
PureInterpretor::PureInterpretor(Automaton::Ref dfa, CharRange::List& subsets)
|
||||
:transition(0)
|
||||
, finalState(0)
|
||||
, relatedFinalState(0)
|
||||
void PureInterpretor::ExpandCharRanges()
|
||||
{
|
||||
stateCount = dfa->states.Count();
|
||||
charSetCount = subsets.Count() + 1;
|
||||
startState = dfa->states.IndexOf(dfa->startState);
|
||||
|
||||
// Map char to input index (equivalent char class)
|
||||
for (vint i = 0; i < SupportedCharCount; i++)
|
||||
{
|
||||
charMap[i] = charSetCount - 1;
|
||||
}
|
||||
for (vint i = 0; i < subsets.Count(); i++)
|
||||
for (vint i = 0; i < charRanges.Count(); i++)
|
||||
{
|
||||
CharRange range = subsets[i];
|
||||
CharRange range = charRanges[i];
|
||||
for (char32_t j = range.begin; j <= range.end; j++)
|
||||
{
|
||||
if (j > MaxChar32) break;
|
||||
charMap[j] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PureInterpretor::PureInterpretor(Automaton::Ref dfa, CharRange::List& subsets)
|
||||
{
|
||||
stateCount = dfa->states.Count();
|
||||
charSetCount = subsets.Count() + 1;
|
||||
startState = dfa->states.IndexOf(dfa->startState);
|
||||
|
||||
// Map char to input index (equivalent char class)
|
||||
CopyFrom(charRanges, subsets);
|
||||
ExpandCharRanges();
|
||||
|
||||
// Create transitions from DFA, using input index to represent input char
|
||||
transition = new vint * [stateCount];
|
||||
transitions = new vint[stateCount * charSetCount];
|
||||
for (vint i = 0; i < stateCount; i++)
|
||||
{
|
||||
transition[i] = new vint[charSetCount];
|
||||
for (vint j = 0; j < charSetCount; j++)
|
||||
{
|
||||
transition[i][j] = -1;
|
||||
transitions[i * charSetCount + j] = -1;
|
||||
}
|
||||
|
||||
State* state = dfa->states[i].Obj();
|
||||
@@ -1187,7 +1390,7 @@ PureInterpretor
|
||||
{
|
||||
CHECK_ERROR(false, L"PureInterpretor::PureInterpretor(Automaton::Ref, CharRange::List&)#Specified chars don't appear in the normalized char ranges.");
|
||||
}
|
||||
transition[i][index] = dfa->states.IndexOf(dfaTransition->target);
|
||||
transitions[i * charSetCount + index] = dfa->states.IndexOf(dfaTransition->target);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1208,11 +1411,7 @@ PureInterpretor
|
||||
{
|
||||
if (relatedFinalState) delete[] relatedFinalState;
|
||||
delete[] finalState;
|
||||
for (vint i = 0; i < stateCount; i++)
|
||||
{
|
||||
delete[] transition[i];
|
||||
}
|
||||
delete[] transition;
|
||||
delete[] transitions;
|
||||
}
|
||||
|
||||
template<typename TChar>
|
||||
@@ -1244,7 +1443,7 @@ PureInterpretor
|
||||
if (c >= SupportedCharCount) break;
|
||||
|
||||
vint charIndex = charMap[c];
|
||||
currentState = transition[currentState][charIndex];
|
||||
currentState = transitions[currentState * charSetCount + charIndex];
|
||||
}
|
||||
|
||||
if (result.finalState == -1)
|
||||
@@ -1286,7 +1485,7 @@ PureInterpretor
|
||||
if (0 <= state && state < stateCount && 0 <= input && input <= MaxChar32)
|
||||
{
|
||||
vint charIndex = charMap[input];
|
||||
vint nextState = transition[state][charIndex];
|
||||
vint nextState = transitions[state * charSetCount + charIndex];
|
||||
return nextState;
|
||||
}
|
||||
else
|
||||
@@ -1305,7 +1504,7 @@ PureInterpretor
|
||||
if (state == -1) return true;
|
||||
for (vint i = 0; i < charSetCount; i++)
|
||||
{
|
||||
if (transition[state][i] != -1)
|
||||
if (transitions[state * charSetCount + i] != -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1332,7 +1531,7 @@ PureInterpretor
|
||||
vint state = -1;
|
||||
for (vint j = 0; j < charSetCount; j++)
|
||||
{
|
||||
vint nextState = transition[i][j];
|
||||
vint nextState = transitions[i * charSetCount + j];
|
||||
if (nextState != -1)
|
||||
{
|
||||
state = relatedFinalState[nextState];
|
||||
@@ -1981,7 +2180,7 @@ MergeAlgorithm
|
||||
}
|
||||
else if (target->regex->definitions.Keys().Contains(expression->name))
|
||||
{
|
||||
target->definitions.Add(expression->name, 0);
|
||||
target->definitions.Add(expression->name, nullptr);
|
||||
Expression::Ref result = Invoke(target->regex->definitions[expression->name], target);
|
||||
target->definitions.Set(expression->name, result);
|
||||
return result;
|
||||
@@ -4035,93 +4234,80 @@ Helpers
|
||||
Automaton::Ref NfaToDfa(Automaton::Ref source, Group<State*, State*>& dfaStateMap)
|
||||
{
|
||||
Automaton::Ref target = new Automaton;
|
||||
Group<Transition*, Transition*> nfaTransitions;
|
||||
List<Transition*> transitionClasses; // Maintain order for nfaTransitions.Keys
|
||||
|
||||
CopyFrom(target->captureNames, source->captureNames);
|
||||
State* startState = target->NewState();
|
||||
target->startState = startState;
|
||||
dfaStateMap.Add(startState, source->startState);
|
||||
|
||||
SortedList<State*> transitionTargets;
|
||||
SortedList<State*> relativeStates;
|
||||
transitionTargets.SetLessMemoryMode(false);
|
||||
relativeStates.SetLessMemoryMode(false);
|
||||
|
||||
for (vint i = 0; i < target->states.Count(); i++)
|
||||
for (auto currentState_ : target->states)
|
||||
{
|
||||
State* currentState = target->states[i].Obj();
|
||||
nfaTransitions.Clear();
|
||||
transitionClasses.Clear();
|
||||
Group<Transition*, Transition*> nfaClassToTransitions;
|
||||
Dictionary<Transition*, Transition*> nfaTransitionToClass;
|
||||
List<Transition*> orderedTransitionClasses;
|
||||
|
||||
State* currentState = currentState_.Obj();
|
||||
|
||||
// Iterate through all NFA states which represent the DFA state
|
||||
const List<State*>& nfaStates = dfaStateMap[currentState];
|
||||
for (vint j = 0; j < nfaStates.Count(); j++)
|
||||
for (auto nfaState : dfaStateMap[currentState])
|
||||
{
|
||||
State* nfaState = nfaStates.Get(j);
|
||||
// Iterate through all transitions from those NFA states
|
||||
for (vint k = 0; k < nfaState->transitions.Count(); k++)
|
||||
for (auto nfaTransition : nfaState->transitions)
|
||||
{
|
||||
Transition* nfaTransition = nfaState->transitions[k];
|
||||
Transition* transitionClass = nullptr;
|
||||
|
||||
// Check if there is any key in nfaTransitions that has the same input as the current transition
|
||||
Transition* transitionClass = 0;
|
||||
for (vint l = 0; l < nfaTransitions.Keys().Count(); l++)
|
||||
{
|
||||
Transition* key = nfaTransitions.Keys()[l];
|
||||
if (AreEqual(key, nfaTransition))
|
||||
vint index = nfaTransitionToClass.Keys().IndexOf(nfaTransition);
|
||||
if (index != -1) transitionClass = nfaTransitionToClass.Values()[index];
|
||||
}
|
||||
|
||||
if (transitionClass == nullptr)
|
||||
{
|
||||
for (vint l = 0; l < orderedTransitionClasses.Count(); l++)
|
||||
{
|
||||
transitionClass = key;
|
||||
break;
|
||||
Transition* key = orderedTransitionClasses[l];
|
||||
if (AreEqual(key, nfaTransition))
|
||||
{
|
||||
transitionClass = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new key if not
|
||||
if (transitionClass == 0)
|
||||
if (transitionClass == nullptr)
|
||||
{
|
||||
transitionClass = nfaTransition;
|
||||
transitionClasses.Add(transitionClass);
|
||||
orderedTransitionClasses.Add(transitionClass);
|
||||
}
|
||||
// Group the transition
|
||||
nfaTransitions.Add(transitionClass, nfaTransition);
|
||||
nfaClassToTransitions.Add(transitionClass, nfaTransition);
|
||||
nfaTransitionToClass.Add(nfaTransition, transitionClass);
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through all key transition that represent all existing transition inputs from the same state
|
||||
for (vint j = 0; j < transitionClasses.Count(); j++)
|
||||
for (auto transitionClass : orderedTransitionClasses)
|
||||
{
|
||||
const List<Transition*>& transitionSet = nfaTransitions[transitionClasses[j]];
|
||||
auto&& equivalentTransitions = nfaClassToTransitions[transitionClass];
|
||||
|
||||
// Sort all target states and keep unique
|
||||
transitionTargets.Clear();
|
||||
for (vint l = 0; l < transitionSet.Count(); l++)
|
||||
{
|
||||
State* nfaState = transitionSet.Get(l)->target;
|
||||
if (!transitionTargets.Contains(nfaState))
|
||||
{
|
||||
transitionTargets.Add(nfaState);
|
||||
}
|
||||
}
|
||||
List<State*> transitionTargets;
|
||||
CopyFrom(
|
||||
transitionTargets,
|
||||
From(equivalentTransitions)
|
||||
.Select([](auto t) { return t->target; })
|
||||
.Distinct()
|
||||
);
|
||||
|
||||
// Check if these NFA states represent a created DFA state
|
||||
State* dfaState = 0;
|
||||
for (vint k = 0; k < dfaStateMap.Count(); k++)
|
||||
{
|
||||
// Sort NFA states for a certain DFA state
|
||||
CopyFrom(relativeStates, dfaStateMap.GetByIndex(k));
|
||||
// Compare two NFA states set
|
||||
if (relativeStates.Count() == transitionTargets.Count())
|
||||
if (CompareEnumerable(transitionTargets, dfaStateMap.GetByIndex(k)) == 0)
|
||||
{
|
||||
bool equal = true;
|
||||
for (vint l = 0; l < relativeStates.Count(); l++)
|
||||
{
|
||||
if (relativeStates[l] != transitionTargets[l])
|
||||
{
|
||||
equal = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (equal)
|
||||
{
|
||||
dfaState = dfaStateMap.Keys()[k];
|
||||
break;
|
||||
}
|
||||
dfaState = dfaStateMap.Keys()[k];
|
||||
}
|
||||
}
|
||||
// Create a new DFA state if there is not
|
||||
@@ -4138,7 +4324,6 @@ Helpers
|
||||
}
|
||||
}
|
||||
// Create corresponding DFA transition
|
||||
Transition* transitionClass = transitionClasses[j];
|
||||
Transition* newTransition = target->NewTransition(currentState, dfaState);
|
||||
newTransition->capture = transitionClass->capture;
|
||||
newTransition->index = transitionClass->index;
|
||||
|
||||
+26
-5
@@ -3,6 +3,7 @@ THIS FILE IS AUTOMATICALLY GENERATED. DO NOT MODIFY
|
||||
DEVELOPER: Zihan Chen(vczh)
|
||||
***********************************************************************/
|
||||
#include "Vlpp.h"
|
||||
#include "VlppOS.h"
|
||||
|
||||
/***********************************************************************
|
||||
.\REGEX.H
|
||||
@@ -18,6 +19,11 @@ Licensed under https://github.com/vczh-libraries/License
|
||||
|
||||
namespace vl
|
||||
{
|
||||
namespace stream
|
||||
{
|
||||
class IStream;
|
||||
}
|
||||
|
||||
namespace regex_internal
|
||||
{
|
||||
class PureResult;
|
||||
@@ -1114,7 +1120,6 @@ RegexLexer
|
||||
{
|
||||
protected:
|
||||
regex_internal::PureInterpretor* pure = nullptr;
|
||||
collections::Array<vint> ids;
|
||||
collections::Array<vint> stateTokens;
|
||||
|
||||
public:
|
||||
@@ -1156,7 +1161,10 @@ RegexLexer
|
||||
/// <param name="tokens">ALl regular expression, each one represent a kind of tokens.</param>
|
||||
|
||||
RegexLexer_(const collections::IEnumerable<ObjectString<T>>& tokens);
|
||||
RegexLexer_(stream::IStream& inputStream);
|
||||
~RegexLexer_() = default;
|
||||
|
||||
void Serialize(stream::IStream & outputStream);
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
@@ -1917,7 +1925,8 @@ Helper Functions
|
||||
|
||||
public:
|
||||
RegexException(const WString& _message, const U32String& _code, vint _position)
|
||||
: code(_code)
|
||||
: Exception(_message)
|
||||
, code(_code)
|
||||
, position(_position)
|
||||
{
|
||||
}
|
||||
@@ -1996,6 +2005,11 @@ Licensed under https://github.com/vczh-libraries/License
|
||||
|
||||
namespace vl
|
||||
{
|
||||
namespace stream
|
||||
{
|
||||
class IStream;
|
||||
}
|
||||
|
||||
namespace regex_internal
|
||||
{
|
||||
class PureResult
|
||||
@@ -2009,20 +2023,27 @@ namespace vl
|
||||
|
||||
class PureInterpretor : public Object
|
||||
{
|
||||
using CharRangeArray = collections::Array<CharRange>;
|
||||
protected:
|
||||
static const vint SupportedCharCount = MaxChar32 + 1;
|
||||
|
||||
CharRangeArray charRanges;
|
||||
vint charMap[SupportedCharCount]; // char -> char set index
|
||||
vint** transition; // (state * char set index) -> state*
|
||||
bool* finalState; // state -> bool
|
||||
vint* relatedFinalState; // sate -> (finalState or -1)
|
||||
vint* transitions = nullptr; // (state * charSetCount + charSetIndex) -> state
|
||||
bool* finalState = nullptr; // state -> bool
|
||||
vint* relatedFinalState = nullptr; // state -> (finalState or -1)
|
||||
vint stateCount;
|
||||
vint charSetCount;
|
||||
vint startState;
|
||||
|
||||
void ExpandCharRanges();
|
||||
public:
|
||||
PureInterpretor(Automaton::Ref dfa, CharRange::List& subsets);
|
||||
PureInterpretor(stream::IStream& inputStream);
|
||||
~PureInterpretor();
|
||||
|
||||
void Serialize(stream::IStream& outputStream);
|
||||
|
||||
template<typename TChar>
|
||||
bool MatchHead(const TChar* input, const TChar* start, PureResult& result);
|
||||
|
||||
|
||||
+12531
-8670
File diff suppressed because one or more lines are too long
+3400
-2458
File diff suppressed because it is too large
Load Diff
@@ -249,15 +249,11 @@ WfRuntimeThreadContext
|
||||
WfRuntimeThreadContext::WfRuntimeThreadContext(Ptr<WfRuntimeGlobalContext> _context)
|
||||
:globalContext(_context)
|
||||
{
|
||||
stack.SetLessMemoryMode(false);
|
||||
stackFrames.SetLessMemoryMode(false);
|
||||
}
|
||||
|
||||
WfRuntimeThreadContext::WfRuntimeThreadContext(Ptr<WfAssembly> _assembly)
|
||||
:globalContext(new WfRuntimeGlobalContext(_assembly))
|
||||
{
|
||||
stack.SetLessMemoryMode(false);
|
||||
stackFrames.SetLessMemoryMode(false);
|
||||
}
|
||||
|
||||
WfRuntimeStackFrame& WfRuntimeThreadContext::GetCurrentStackFrame()
|
||||
@@ -907,6 +903,18 @@ Serialization (CollectMetadata)
|
||||
Serizliation (Data Structures)
|
||||
***********************************************************************/
|
||||
|
||||
BEGIN_SERIALIZATION(glr::ParsingTextPos)
|
||||
SERIALIZE(index)
|
||||
SERIALIZE(row)
|
||||
SERIALIZE(column)
|
||||
END_SERIALIZATION
|
||||
|
||||
BEGIN_SERIALIZATION(glr::ParsingTextRange)
|
||||
SERIALIZE(start)
|
||||
SERIALIZE(end)
|
||||
SERIALIZE(codeIndex)
|
||||
END_SERIALIZATION
|
||||
|
||||
BEGIN_SERIALIZATION(WfInstructionDebugInfo)
|
||||
SERIALIZE(moduleCodes)
|
||||
SERIALIZE(instructionCodeMapping)
|
||||
@@ -3102,7 +3110,7 @@ WfDebugger
|
||||
return threadContexts[threadContexts.Count() - 1];
|
||||
}
|
||||
|
||||
const parsing::ParsingTextRange& WfDebugger::GetCurrentPosition(bool beforeCodegen, WfRuntimeThreadContext* context, vint callStackIndex)
|
||||
const glr::ParsingTextRange& WfDebugger::GetCurrentPosition(bool beforeCodegen, WfRuntimeThreadContext* context, vint callStackIndex)
|
||||
{
|
||||
if (!context)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
THIS FILE IS AUTOMATICALLY GENERATED. DO NOT MODIFY
|
||||
DEVELOPER: Zihan Chen(vczh)
|
||||
***********************************************************************/
|
||||
#include "VlppParser.h"
|
||||
#include "VlppGlrParser.h"
|
||||
#include "VlppReflection.h"
|
||||
#include "VlppOS.h"
|
||||
#include "Vlpp.h"
|
||||
@@ -912,7 +912,7 @@ Assembly
|
||||
/// <summary>Module codes.</summary>
|
||||
collections::List<WString> moduleCodes; // codeIndex -> code
|
||||
/// <summary>Mapping information from every instruction to code. Use[F:vl.parsing.ParsingTextRange.codeIndex] for accessing <see cref="moduleCodes"/>.</summary>
|
||||
collections::List<parsing::ParsingTextRange> instructionCodeMapping; // instruction -> range
|
||||
collections::List<glr::ParsingTextRange> instructionCodeMapping; // instruction -> range
|
||||
/// <summary>Mapping information from every row in codes to instructions. Value of the key is (codeIndex, row).</summary>
|
||||
collections::Group<Tuple<vint, vint>, vint> codeInstructionMapping; // (codeIndex, row) -> instruction [generated]
|
||||
|
||||
@@ -1483,7 +1483,7 @@ Debugger
|
||||
/// <param name="beforeCodegen">Set to true to apply the source code information to original source code.</param>
|
||||
/// <param name="context">Specify a thread context. Set to null to use the top thread context.</param>
|
||||
/// <param name="callStackIndex">Specify a call stack index. Set to null to use the top call stack item of the specified thread context.</param>
|
||||
const parsing::ParsingTextRange& GetCurrentPosition(bool beforeCodegen = true, WfRuntimeThreadContext* context = nullptr, vint callStackIndex = -1);
|
||||
const glr::ParsingTextRange& GetCurrentPosition(bool beforeCodegen = true, WfRuntimeThreadContext* context = nullptr, vint callStackIndex = -1);
|
||||
/// <summary>Get the variable value by name in the current scope.</summary>
|
||||
/// <returns>The value.</returns>
|
||||
/// <param name="name">The name.</param>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user