Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions g4/SecLangLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@ limitations under the License.
lexer grammar SecLangLexer;

tokens {
QUOTE, SINGLE_QUOTE, EQUAL, COLON, EQUALS_PLUS, EQUALS_MINUS, COMMA, PIPE, CONFIG_VALUE_PATH, NOT
QUOTE, SINGLE_QUOTE, EQUAL, COLON, EQUALS_PLUS, EQUALS_MINUS, COMMA, PIPE, CONFIG_VALUE_PATH, NOT, NEW_LINE_INDENT_BLOCK, INLINE_INDENT_BLOCK
}

NEW_LINE_INDENT_BLOCK_DEFAULT
: '\\'? '\n ' -> type(NEW_LINE_INDENT_BLOCK)
;

INLINE_INDENT_BLOCK_DEFAULT
: ' ' -> type(INLINE_INDENT_BLOCK)
;

WS
: ([ \t\r\n]+ | '\\' '\n' | '\\') -> skip
: ([ \t\r\n] | '\\') -> skip
;

COMMENT
Expand Down
20 changes: 14 additions & 6 deletions g4/SecLangParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ configuration
;

stmt:
comment? rules_directive variables operator actions?
| comment? rule_script_directive file_path actions?
| comment? rule_script_directive QUOTE file_path QUOTE actions?
comment? newline_indent? inline_indent* rules_directive variables operator actions?
| comment? newline_indent? inline_indent* rule_script_directive file_path actions?
| comment? newline_indent? inline_indent*rule_script_directive QUOTE file_path QUOTE actions?
| comment? remove_rule_by_id remove_rule_by_id_values+
| comment? string_remove_rules string_remove_rules_values
| comment? string_remove_rules QUOTE string_remove_rules_values QUOTE
Expand All @@ -36,7 +36,7 @@ stmt:
| comment? update_target_rules update_target_rules_values update_variables PIPE new_target
| comment? update_target_rules QUOTE update_target_rules_values QUOTE update_variables PIPE new_target
| comment? update_action_rule id actions
| comment? engine_config_directive
| comment? newline_indent? inline_indent* engine_config_directive
| comment;

comment:
Expand All @@ -50,7 +50,7 @@ rules_directive:
engine_config_directive:
stmt_audit_log values
| stmt_audit_log QUOTE values QUOTE
| engine_config_action_directive actions
| newline_indent? inline_indent* engine_config_action_directive actions
| string_engine_config_directive QUOTE values QUOTE
| sec_marker_directive QUOTE values QUOTE
| engine_config_directive_with_param values
Expand Down Expand Up @@ -343,7 +343,7 @@ collection_enum:
;

actions:
QUOTE action (COMMA action)* QUOTE
newline_indent? inline_indent* QUOTE action newline_indent? inline_indent* (COMMA newline_indent? inline_indent* action)* QUOTE
;

action:
Expand Down Expand Up @@ -503,4 +503,12 @@ var_assignment:
ctl_id:
INT
| IDENT
;

newline_indent:
NEW_LINE_INDENT_BLOCK
;

inline_indent:
INLINE_INDENT_BLOCK
;
5,871 changes: 2,941 additions & 2,930 deletions parser/seclang_lexer.go

Large diffs are not rendered by default.

2,691 changes: 1,707 additions & 984 deletions parser/seclang_parser.go

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions parser/seclangparser_base_listener.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions parser/seclangparser_listener.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading