Skip to content

Commit

Permalink
Update parser example to latest API.
Browse files Browse the repository at this point in the history
  • Loading branch information
tritao committed Jul 14, 2023
1 parent bb31bd6 commit 8c1fa18
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions examples/Parser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public static void Main(string[] args)
ParseSourceFile(file);
}

public static bool ParseSourceFile(string file)
private static bool ParseSourceFile(string file)
{
// Lets setup the options for parsing the file.
var parserOptions = new ParserOptions
{
LanguageVersion = LanguageVersion.CPP11,
LanguageVersion = LanguageVersion.CPP20_GNU,

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

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

// We create the Clang parser and parse the source code.
var parser = new ClangParser();
var parserResult = parser.ParseSourceFile(file, parserOptions);
var parserResult = ClangParser.ParseSourceFile(file, parserOptions);

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

0 comments on commit 8c1fa18

Please sign in to comment.