Skip to content

Commit

Permalink
Some fixes for GMCompFix (don't convert macros, preproc comments for …
Browse files Browse the repository at this point in the history
…parsing)
  • Loading branch information
YellowAfterlife committed Oct 17, 2020
1 parent a134d70 commit 35d260a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/VitGML.hx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class VitGML {
case "*".code: pos = src.skipComment(pos + 1);
}
};
#if !gmv_nc
case '#'.code: { // possibly macros or regions
if (!src.fastCodeAt(pos).isIdent0()) {
// not what we want
Expand Down Expand Up @@ -94,6 +95,7 @@ class VitGML {
}
}
};
#end
case '@'.code: pos = src.skipAtSignCommon(pos);
case '"'.code: pos = src.skipString2(pos);
default:
Expand Down Expand Up @@ -255,8 +257,8 @@ class VitGML {
}

public static function proc(src:String, ctx:String, isInline:Bool = false):String {
#if !gmv_nc
src = escapeComments(src);
#if !gmv_nc
src = fixSpaces(src);
src = fixVarDecl(src, ctx);
if (src.indexOf("?") >= 0) src = replaceTernaryOperators(src, isInline);
Expand Down Expand Up @@ -323,6 +325,8 @@ class VitGML {
}
//
var flushTill = dotIndex >= 0 ? dotPrefixStart : at;
//trace(src.substring(0, flushTill));
//trace(src.isStatementBacktrack(flushTill, isInline), remap.statOnly, remap.exprOnly);
if (remap.statOnly) {
if (!src.isStatementBacktrack(flushTill, isInline)) continue;
} else if (remap.exprOnly) {
Expand Down Expand Up @@ -639,6 +643,7 @@ class VitGML {
var id = src.substring(at, pos);
var remaps = Ruleset.remaps[id];
var foundRemap:Bool;
//trace(src.substring(pos) + "\n\n");
if (remaps != null) {
foundRemap = procRemaps(id, at, remaps);
} else do {
Expand All @@ -651,7 +656,9 @@ class VitGML {
var posAtIdentEnd = pos;
pos = posAfterIdent + 2;
foundRemap = procRemaps("", at, remaps);
if (!foundRemap) pos = posAtIdentEnd;
if (!foundRemap) {
pos = posAtIdentEnd;
}
} while (false);
if (!foundRemap) {
var arr = Ruleset.importsByIdent[id];
Expand Down

0 comments on commit 35d260a

Please sign in to comment.