Skip to content

Commit

Permalink
Merge pull request #66 from goulash32/main
Browse files Browse the repository at this point in the history
Support for multiple subsequent metadata declarations
  • Loading branch information
sashi0034 authored Jan 5, 2025
2 parents 38dcf9b + dae04e7 commit d7ab967
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions server/src/compile/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ function parseMetadata(parser: ParserState): ParsedToken[] {

let level = 0;

const metadata: ParsedToken[] = [];
let metadata: ParsedToken[] = [];
while (parser.isEnd() === false) {
if (parser.next().text === '[') {
if (level > 0) metadata.push(parser.next());
Expand All @@ -521,7 +521,18 @@ function parseMetadata(parser: ParserState): ParsedToken[] {
level--;
parser.commit(HighlightToken.Operator);

if (level === 0) return metadata;
if (level === 0) {
// Since AngelScript supports multiple metadata declarations in subsequent pairs of '[' and ']', we recursively parse those declarations here.
// eg. '[Hello][World]' is valid, as is
// [Hello]
// [World]
if(parser.next().text === '[') {
metadata = [...metadata, ...parseMetadata(parser)];
}

return metadata;
}

else metadata.push(parser.next());
} else {
metadata.push(parser.next());
Expand Down

0 comments on commit d7ab967

Please sign in to comment.