From 231fd7402a9ff90bbc3e0771ff5fd4056f0f22d0 Mon Sep 17 00:00:00 2001 From: idhrendur Date: Sun, 20 Oct 2013 12:17:22 -0700 Subject: [PATCH] The parser now handles Windows-1252 --- Data Files/Changelog.txt | 5 ++++- Source/Parsers/Parser.cpp | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Data Files/Changelog.txt b/Data Files/Changelog.txt index 1e9f430f7..7b2e13600 100644 --- a/Data Files/Changelog.txt +++ b/Data Files/Changelog.txt @@ -535,4 +535,7 @@ Revision Log Message 515 Add copyright and license to source files 516 Handle missing localisation when generating new countries 517 Commiting files not included in revision 516 -518 Merge main into mod \ No newline at end of file +518 Merge main into mod + + +520 The parser now handles Windows-1252 \ No newline at end of file diff --git a/Source/Parsers/Parser.cpp b/Source/Parsers/Parser.cpp index ffef3327b..aa4cdf0d7 100644 --- a/Source/Parsers/Parser.cpp +++ b/Source/Parsers/Parser.cpp @@ -138,9 +138,9 @@ struct Parser : public qi::grammar > { Parser() : Parser::base_type(root) { braces = lit('{') >> *(iso8859_1::space) >> lit('}'); - str = lexeme[lit('"') >> raw[*(~iso8859_1::char_('"'))] >> lit('"')]; - tolleaf = raw[+(~iso8859_1::char_("\"{}= \t\r\n"))]; - leaf = raw[+(iso8859_1::alnum | iso8859_1::char_("-._:"))]; + str = lexeme[lit('"') >> raw[*(~iso8859_1::char_('"') | lit(0x80) | lit(0x81) | lit(0x82) | lit(0x83) | lit(0x84) | lit(0x85) | lit(0x86) | lit(0x87) | lit(0x88) | lit(0x89) | lit(0x8A) | lit(0x8B) | lit(0x8C) | lit(0x8D) | lit(0x8E) | lit(0x8F) | lit(0x90) | lit(0x91) | lit(0x92) | lit(0x93) | lit(0x94) | lit(0x95) | lit(0x96) | lit(0x97) | lit(0x98) | lit(0x99) | lit(0x9A) | lit(0x9B) | lit(0x9C) | lit(0x9D) | lit(0x9E) | lit(0x9F))] >> lit('"')]; + tolleaf = raw[+(~iso8859_1::char_("\"{}= \t\r\n") | lit(0x80) | lit(0x81) | lit(0x82) | lit(0x83) | lit(0x84) | lit(0x85) | lit(0x86) | lit(0x87) | lit(0x88) | lit(0x89) | lit(0x8A) | lit(0x8B) | lit(0x8C) | lit(0x8D) | lit(0x8E) | lit(0x8F) | lit(0x90) | lit(0x91) | lit(0x92) | lit(0x93) | lit(0x94) | lit(0x95) | lit(0x96) | lit(0x97) | lit(0x98) | lit(0x99) | lit(0x9A) | lit(0x9B) | lit(0x9C) | lit(0x9D) | lit(0x9E) | lit(0x9F))]; + leaf = raw[+(iso8859_1::alnum | iso8859_1::char_("-._:") | lit(0x80) | lit(0x81) | lit(0x82) | lit(0x83) | lit(0x84) | lit(0x85) | lit(0x86) | lit(0x87) | lit(0x88) | lit(0x89) | lit(0x8A) | lit(0x8B) | lit(0x8C) | lit(0x8D) | lit(0x8E) | lit(0x8F) | lit(0x90) | lit(0x91) | lit(0x92) | lit(0x93) | lit(0x94) | lit(0x95) | lit(0x96) | lit(0x97) | lit(0x98) | lit(0x99) | lit(0x9A) | lit(0x9B) | lit(0x9C) | lit(0x9D) | lit(0x9E) | lit(0x9F))]; taglist = lit('{') >> omit[*(iso8859_1::space)] >> lexeme[( ( str | skip[tolleaf] ) % *(iso8859_1::space) )] >> omit[*(iso8859_1::space)] >> lit('}'); object = raw[lit('{') >> *(root) >> *(iso8859_1::space) >> lit('}')]; objlist = raw[lit('{') >> *( *(iso8859_1::space) >> object[&pushObj] ) >> *(iso8859_1::space) >> lit('}')];