Skip to content

Commit

Permalink
Merge pull request #140 from vlad902/function-pointer-parsing
Browse files Browse the repository at this point in the history
Parse function pointers
  • Loading branch information
Fabian Yamaguchi committed Dec 1, 2016
2 parents c2358ff + 5705342 commit de0cd6a
Show file tree
Hide file tree
Showing 17 changed files with 10,345 additions and 20,554 deletions.
2 changes: 1 addition & 1 deletion projects/extensions/joern-fuzzyc/genParsers.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
antlr4='java -jar ./antlr4-4.5.1-SNAPSHOT-complete.jar'
antlr4='java -jar ./antlr4-4.5.4-SNAPSHOT-complete.jar'

$antlr4 src/main/java/antlr/Module.g4
$antlr4 src/main/java/antlr/Function.g4
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Encompasses declarations in the module scope, e.g. variable declarations in C++ classes

grammar CoarseSimpleDecl;

import SimpleDecl;

// The following two contain 'water'-rules for expressions

init_declarator : declarator (('(' expr? ')') | ('=' assign_expr_w_))?;
declarator: ptrs? identifier type_suffix?;

declarator: ptrs? identifier type_suffix? |
ptrs? '(' func_ptrs identifier ')' type_suffix;

type_suffix : ('[' constant_expr_w_ ']') | param_type_list;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Encompasses declarations in the function scope, e.g. local variable declarations

grammar FineSimpleDecl;

import SimpleDecl;
Expand All @@ -7,7 +9,8 @@ init_declarator: declarator '(' expr? ')' #initDeclWithCall
| declarator #initDeclSimple
;

declarator: ptrs? identifier type_suffix?;
declarator: ptrs? identifier type_suffix? |
ptrs? '(' func_ptrs identifier ')' type_suffix;

type_suffix : ('[' conditional_expression? ']') | param_type_list;

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ grammar Function;
import ModuleLex, Common, Expressions, FineSimpleDecl;

@header{
package antlr.C;
package antlr;
}

statements: (pre_opener
Expand Down

0 comments on commit de0cd6a

Please sign in to comment.