Skip to content

Commit ec8d9ad

Browse files
committed
Support heredoc string literals.
1 parent 5ed9d77 commit ec8d9ad

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"profiles": {
3+
"ServerCodeExciser": {
4+
"commandName": "Project",
5+
"commandLineArgs": "-s -o D:\\test D:\\p4\\games\\Games\\Pioneer\\Script"
6+
}
7+
}
8+
}

ServerCodeExciserTest/AngelscriptSyntaxTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ public void FunctionModifier(string modifier)
6060
[DataRow("float64", "0.0")]
6161
[DataRow("doublt", "0.0")]
6262
[DataRow("bool", "false")]
63-
[DataRow("FName", "n\"MyName\"")] // https://angelscript.hazelight.se/scripting/fname-literals/
64-
[DataRow("string", "f\"Formatted String: {L:0.1f}\\u00B0\"")] // https://angelscript.hazelight.se/scripting/format-strings/
63+
[DataRow("string", "\"\"\"\r\nmulti line string\r\n\"\"\"")] // heredoc: https://www.angelcode.com/angelscript/sdk/docs/manual/doc_datatypes_strings.html
64+
[DataRow("FName", "n\"MyName\"")] // FName Literals: https://angelscript.hazelight.se/scripting/fname-literals/
65+
[DataRow("string", "f\"Formatted String: {L:0.1f}\\u00B0\"")] // Formatted Strings: https://angelscript.hazelight.se/scripting/format-strings/
6566
public void DataType(string type, string value)
6667
{
6768
ParseScript($"{type} VAR = {value};");

UnrealAngelscriptParser/Grammar/UnrealAngelscriptLexer.g4

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ FloatingLiteral:
2424
// https://angelscript.hazelight.se/scripting/format-strings/
2525
fragment Angelscriptstringprefix: 'n' | 'f';
2626

27-
StringLiteral: (Encodingprefix | Angelscriptstringprefix)? (Rawstring | '"' Schar* '"');
27+
// Angelscript Heredoc string literals
28+
// https://www.angelcode.com/angelscript/sdk/docs/manual/doc_datatypes_strings.html
29+
fragment HeredocString: '"""' .*? '"""';
30+
31+
StringLiteral: (Encodingprefix | Angelscriptstringprefix)? (HeredocString | Rawstring | '"' Schar* '"');
2832

2933
BooleanLiteral: False | True;
3034

0 commit comments

Comments
 (0)