Skip to content

Commit 8c1fa18

Browse files
committed
Update parser example to latest API.
1 parent bb31bd6 commit 8c1fa18

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

examples/Parser/Parser.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ public static void Main(string[] args)
2323
ParseSourceFile(file);
2424
}
2525

26-
public static bool ParseSourceFile(string file)
26+
private static bool ParseSourceFile(string file)
2727
{
2828
// Lets setup the options for parsing the file.
2929
var parserOptions = new ParserOptions
3030
{
31-
LanguageVersion = LanguageVersion.CPP11,
31+
LanguageVersion = LanguageVersion.CPP20_GNU,
3232

3333
// Verbose here will make sure the parser outputs some extra debugging
3434
// information regarding include directories, which can be helpful when
@@ -37,13 +37,10 @@ public static bool ParseSourceFile(string file)
3737
};
3838

3939
// This will setup the necessary system include paths and arguments for parsing.
40-
// It will probe into the registry (on Windows) and filesystem to find the paths
41-
// of the system toolchains and necessary include directories.
42-
parserOptions.Setup();
40+
parserOptions.Setup(Platform.Host);
4341

4442
// We create the Clang parser and parse the source code.
45-
var parser = new ClangParser();
46-
var parserResult = parser.ParseSourceFile(file, parserOptions);
43+
var parserResult = ClangParser.ParseSourceFile(file, parserOptions);
4744

4845
// If there was some kind of error parsing, then lets print some diagnostics.
4946
if (parserResult.Kind != ParserResultKind.Success)

0 commit comments

Comments
 (0)