diff options
author | Basil <basil@miranda-ng.org> | 2013-02-01 16:19:57 +0000 |
---|---|---|
committer | Basil <basil@miranda-ng.org> | 2013-02-01 16:19:57 +0000 |
commit | e735b19bd329c5b56f8201b0aee6e9d11b815753 (patch) | |
tree | 9c523d0122a7055567ae5bd8baf87c33a95c02b5 /tools | |
parent | 6e8b980dd716254abd4de705bf23b031d2a3c9a3 (diff) |
Enhanced RC files parsing. Now strings with double quotes parsed correctly.
git-svn-id: http://svn.miranda-ng.org/main/trunk@3391 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lpgen/lpgen.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/lpgen/lpgen.js b/tools/lpgen/lpgen.js index faae6f55aa..a26c8a9c7c 100644 --- a/tools/lpgen/lpgen.js +++ b/tools/lpgen/lpgen.js @@ -410,7 +410,7 @@ function ParseRCFile(RC_File,array) { //read on line into rcline
rcline=RC_File_stream.ReadLine();
//find string to translate in rcline by regexp
- rc_regexp=rcline.match(/\s*(?:CONTROL|(?:DEF)?PUSHBUTTON|[LRC]TEXT|GROUPBOX|CAPTION|MENUITEM|POPUP)\s*\"([^\"]+(\"\")?[^\"]*(\"\")?[^\"]*)\"\,?/);
+ rc_regexp=rcline.match(/\s*(?:CONTROL|(?:DEF)?PUSHBUTTON|[LRC]TEXT|GROUPBOX|CAPTION|MENUITEM|POPUP)\s*"((?:(?:""[^"]+?"")*[^"]*?)*)"(,|$)/);
// if exist rc_regexp, do checks, double "" removal and add strings into array
if (rc_regexp) {
// check for some garbage like "List1","Tab1" etc. in *.rc files, we do not need this.
@@ -427,6 +427,7 @@ function ParseRCFile(RC_File,array) { case "Custom2": {break};
case "Slider1": {break};
case "Slider2": {break};
+ case "": {break};
//default action is to wrote text inside quoted into array
default:
//if there is double "", replace with single one
@@ -513,14 +514,14 @@ versionfile_stream=FSO.GetFile(VersionFile).OpenAsTextStream(ForReading, Tristat allstrings=versionfile_stream.ReadAll();
//define RegExp for defines.
var filename=/(?:#define\s+_*?FILENAME\s+")(.+)(?=")/m;
-var pluginname=/(?:#define\s+_*?PLUGIN_NAME\s+")(.+)(?=")/i;
-var author=/(?:#define\s+_*?AUTHORS?\s+")(.+)(?=")/i;
+var pluginname=/(?:#define\s+_*?PLUG(?:IN)?_?NAME\s+")(.+)(?=")/i;
+var author=/(?:#define\s+_*?(?:PLUGIN_?)?AUTHORS?\s+")(.+)(?=")/i;
var MAJOR_VERSION=/(?:#define\s+_*?(?:MAJOR_VERSION|VER_MAJOR)\s+)(\d+)/i;
var MINOR_VERSION=/(?:#define\s+_*?(?:MINOR_VERSION|VER_MINOR)\s+)(\d+)/i;
var RELEASE_NUM=/(?:#define\s+_*?(?:RELEASE_NUM|VER_REVISION|VER_RELEASE)\s+)(\d+)/i;
var BUILD_NUM=/(?:#define\s+_*?(?:BUILD_NUM|VER_BUILD)\s+)(\d+)/i;
var VERSION_STRING=/(?:#define\s+_*?VERSION_STRING\s+")([\d\.]+)\"/i;
-var description=/(?:#define\s+_*?(?:PLUGIN_)?DESC(?:RIPTION)?\s+")(.+)(?=")/i;
+var description=/(?:#define\s+_*?(?:PLUGIN_)?DESC(?:RIPTION|_STRING)?\s+")(.+)(?=")/i;
//exec RegExps
filename=filename.exec(allstrings);
pluginname=pluginname.exec(allstrings);
|