mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 20:05:31 +00:00
Make use of \u2190 char optional
VS2010 is not capable of compiling source code with chars beyond the "current code page" reliably.
This commit is contained in:
parent
1e47348daf
commit
546942e389
8
peglib.h
8
peglib.h
@ -35,6 +35,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// define if the compiler doesn't support unicode characters reliably in the
|
||||
// source code
|
||||
//#define PEGLIB_NO_UNICODE_CHARS
|
||||
|
||||
namespace peg {
|
||||
|
||||
extern void* enabler;
|
||||
@ -1813,7 +1817,11 @@ private:
|
||||
seq(lit("\\x"), cls("0-9a-fA-F"), opt(cls("0-9a-fA-F"))),
|
||||
seq(npd(chr('\\')), dot()));
|
||||
|
||||
#if !defined(PEGLIB_NO_UNICODE_CHARS)
|
||||
g["LEFTARROW"] <= seq(cho(lit("<-"), lit("←")), g["Spacing"]);
|
||||
#else
|
||||
g["LEFTARROW"] <= seq(lit("<-"), g["Spacing"]);
|
||||
#endif
|
||||
~g["SLASH"] <= seq(chr('/'), g["Spacing"]);
|
||||
g["AND"] <= seq(chr('&'), g["Spacing"]);
|
||||
g["NOT"] <= seq(chr('!'), g["Spacing"]);
|
||||
|
15
test/test.cc
15
test/test.cc
@ -5,7 +5,8 @@
|
||||
#include <peglib.h>
|
||||
#include <iostream>
|
||||
|
||||
TEST_CASE("Simple syntax test", "[general]")
|
||||
#if !defined(PEGLIB_NO_UNICODE_CHARS)
|
||||
TEST_CASE("Simple syntax test (with unicode)", "[general]")
|
||||
{
|
||||
peg::parser parser(
|
||||
" ROOT ← _ "
|
||||
@ -15,6 +16,18 @@ TEST_CASE("Simple syntax test", "[general]")
|
||||
bool ret = parser;
|
||||
REQUIRE(ret == true);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_CASE("Simple syntax test", "[general]")
|
||||
{
|
||||
peg::parser parser(
|
||||
" ROOT <- _ "
|
||||
" _ <- ' ' "
|
||||
);
|
||||
|
||||
bool ret = parser;
|
||||
REQUIRE(ret == true);
|
||||
}
|
||||
|
||||
TEST_CASE("Empty syntax test", "[general]")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user