Skip to content

Commit

Permalink
fix a Windows utf-8 coding issue. update Yuescript. [skip CI]
Browse files Browse the repository at this point in the history
  • Loading branch information
pigpigyyy committed Nov 15, 2023
1 parent 73ad33b commit f79f02d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
9 changes: 5 additions & 4 deletions Assets/Script/Dev/Entry.yue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ if App.platform in ["Linux", "Windows", "macOS"]
sleep!
sleep!
showEntry = true
winX = winY = 0
x: winX, y: winY = App.winPosition
if config.winX?
winX = config.winX
else
Expand Down Expand Up @@ -499,8 +499,9 @@ extraOperations = ->
ossLicenses = []
licenseText = Content\load "LICENSES"
if ossLicenseOpen = licenseText?
licenseText = licenseText\gsub "\r\n", "\n"
for license in GSplit licenseText, "\n--------\n", true
if name, text = license\match "[%s\n\r]*([^\n\r]*)[\n\r]*(.*)"
if name, text = license\match "[%s\n]*([^\n]*)[\n]*(.*)"
ossLicenses[] = [name, text]
else
ossLicenseOpen = true
Expand Down Expand Up @@ -690,9 +691,9 @@ entryWindow = threadLoop ->
:themeColor = App
width:fullWidth, :height = App.visualSize

SetNextWindowBgAlpha 0.5
SetNextWindowBgAlpha 0.85
SetNextWindowPos Vec2(5, height - 120), "Always", Vec2 0, 0
SetNextWindowSize Vec2(235, 0), "Always"
SetNextWindowSize Vec2(245, 0), "Always"
Begin "Web IDE", urlWindowFlags, ->
TextColored themeColor, "#{zh and '网页' or 'Web'} IDE"
url = webStatus?.url ?? zh and '不可用' or 'not available'
Expand Down
4 changes: 2 additions & 2 deletions Project/Windows/Dorothy/Dorothy.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,7 @@
<ObjectFileName>$(IntDir)\_1\_2\_3\%(RelativeDir)\</ObjectFileName>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<DisableSpecificWarnings>4819</DisableSpecificWarnings>
<AdditionalOptions>/Zc:__cplusplus /wd4244 /wd4996 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /wd4244 /wd4996 /utf-8 %(AdditionalOptions)</AdditionalOptions>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
Expand Down Expand Up @@ -1991,7 +1991,7 @@
<LanguageStandard>stdcpp20</LanguageStandard>
<ObjectFileName>$(IntDir)\_1\_2\_3\%(RelativeDir)\</ObjectFileName>
<DisableSpecificWarnings>4819</DisableSpecificWarnings>
<AdditionalOptions>/Zc:__cplusplus /wd4244 /wd4996 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /wd4244 /wd4996 /utf-8 %(AdditionalOptions)</AdditionalOptions>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
Expand Down
35 changes: 21 additions & 14 deletions Source/3rdParty/yuescript/yue_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static std::unordered_set<std::string> Metamethods = {
"close"s // Lua 5.4
};

const std::string_view version = "0.20.5"sv;
const std::string_view version = "0.20.6"sv;
const std::string_view extension = "yue"sv;

class CompileError : public std::logic_error {
Expand Down Expand Up @@ -950,6 +950,9 @@ class YueCompilerImpl {
template <class T>
ast_ptr<false, T> toAst(std::string_view codes, ast_node* parent) {
auto res = _parser.parse<T>(std::string(codes));
if (res.error) {
throw CompileError(res.error.value().msg, parent);
}
res.node->traverse([&](ast_node* node) {
node->m_begin.m_line = parent->m_begin.m_line;
node->m_begin.m_col = parent->m_begin.m_col;
Expand Down Expand Up @@ -8808,18 +8811,22 @@ class YueCompilerImpl {
return name;
}

void transformImportAs(ImportAs_t* import, str_list& out) {
ast_node* x = import;
if (!import->target) {
auto name = moduleNameFrom(import->literal);
import->target.set(toAst<Variable_t>(name, x));
void transformImportAs(ImportAs_t* importNode, str_list& out) {
ast_node* x = importNode;
if (!importNode->target) {
auto name = moduleNameFrom(importNode->literal);
if (_parser.match<Variable_t>(name)) {
importNode->target.set(toAst<Variable_t>(name, x));
} else {
throw CompileError("import module name can not be used as a variable name, try renaming it with \"as newName\" clause"sv, importNode->literal);
}
}
if (ast_is<ImportAllMacro_t, ImportTabLit_t>(import->target)) {
x = import->target.get();
bool importAllMacro = import->target.is<ImportAllMacro_t>();
if (ast_is<ImportAllMacro_t, ImportTabLit_t>(importNode->target)) {
x = importNode->target.get();
bool importAllMacro = importNode->target.is<ImportAllMacro_t>();
std::list<std::pair<std::string, std::string>> macroPairs;
auto newTab = x->new_ptr<ImportTabLit_t>();
if (auto tabLit = import->target.as<ImportTabLit_t>()) {
if (auto tabLit = importNode->target.as<ImportTabLit_t>()) {
for (auto item : tabLit->items.objects()) {
switch (item->get_id()) {
#ifdef YUE_NO_MACRO
Expand Down Expand Up @@ -8859,7 +8866,7 @@ class YueCompilerImpl {
}
#ifndef YUE_NO_MACRO
if (importAllMacro || !macroPairs.empty()) {
auto moduleName = _parser.toString(import->literal);
auto moduleName = _parser.toString(importNode->literal);
Utils::replace(moduleName, "'"sv, ""sv);
Utils::replace(moduleName, "\""sv, ""sv);
Utils::trim(moduleName);
Expand Down Expand Up @@ -8935,10 +8942,10 @@ class YueCompilerImpl {
out.push_back(Empty);
return;
} else {
import->target.set(newTab);
importNode->target.set(newTab);
}
}
auto target = import->target.get();
auto target = importNode->target.get();
x = target;
auto value = x->new_ptr<Value_t>();
if (auto var = ast_cast<Variable_t>(target)) {
Expand Down Expand Up @@ -8994,7 +9001,7 @@ class YueCompilerImpl {
auto assignList = x->new_ptr<ExpList_t>();
assignList->exprs.push_back(exp);
auto assign = x->new_ptr<Assign_t>();
assign->values.push_back(toAst<Exp_t>("require "s + _parser.toString(import->literal), x));
assign->values.push_back(toAst<Exp_t>("require "s + _parser.toString(importNode->literal), x));
auto assignment = x->new_ptr<ExpListAssign_t>();
assignment->expList.set(assignList);
assignment->action.set(assign);
Expand Down
1 change: 1 addition & 0 deletions Tools/dora-dora/src/LogView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const LogView = (props: LogViewProps) => {
fontFamily: "Roboto,Helvetica,Arial,sans-serif",
color: Color.TextSecondary
}}
rowHeight={22}
enableSearch stream follow/>
</DialogContent>
<DialogActions>
Expand Down

0 comments on commit f79f02d

Please sign in to comment.