summaryrefslogtreecommitdiffstats
path: root/Source/cmListFileLexer.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-14 19:13:11 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-17 13:06:59 (GMT)
commitdbd933365ec780d27ab7c0dfba30dc1af1094607 (patch)
tree2fd61c1a48fbf8a0cea360400529e1abb588ac11 /Source/cmListFileLexer.h
parent56457837e28de29d4f94b0cc9c47ef314d8f05e1 (diff)
downloadCMake-dbd933365ec780d27ab7c0dfba30dc1af1094607.zip
CMake-dbd933365ec780d27ab7c0dfba30dc1af1094607.tar.gz
CMake-dbd933365ec780d27ab7c0dfba30dc1af1094607.tar.bz2
cmListFileLexer: Allow a leading UTF-8 Byte-Order-Mark (#11137)
Teach the lexer to read a UTF-8, UTF-16 BE/LE, or UTF-32 BE/LE Byte-Order-Mark from the start of a file if any is present. Report an error on files using UTF-16 or UTF-32 and accept a UTF-8 or missing BOM.
Diffstat (limited to 'Source/cmListFileLexer.h')
-rw-r--r--Source/cmListFileLexer.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmListFileLexer.h b/Source/cmListFileLexer.h
index cc78b5c..719347c 100644
--- a/Source/cmListFileLexer.h
+++ b/Source/cmListFileLexer.h
@@ -36,6 +36,17 @@ struct cmListFileLexer_Token_s
int column;
};
+enum cmListFileLexer_BOM_e
+{
+ cmListFileLexer_BOM_None,
+ cmListFileLexer_BOM_UTF8,
+ cmListFileLexer_BOM_UTF16BE,
+ cmListFileLexer_BOM_UTF16LE,
+ cmListFileLexer_BOM_UTF32BE,
+ cmListFileLexer_BOM_UTF32LE
+};
+typedef enum cmListFileLexer_BOM_e cmListFileLexer_BOM;
+
typedef struct cmListFileLexer_s cmListFileLexer;
#ifdef __cplusplus
@@ -44,7 +55,8 @@ extern "C"
#endif
cmListFileLexer* cmListFileLexer_New();
-int cmListFileLexer_SetFileName(cmListFileLexer*, const char*);
+int cmListFileLexer_SetFileName(cmListFileLexer*, const char*,
+ cmListFileLexer_BOM* bom);
int cmListFileLexer_SetString(cmListFileLexer*, const char*);
cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer*);
long cmListFileLexer_GetCurrentLine(cmListFileLexer*);