https://github.com/antlr/grammars-v4
Revision 3ba0d9b93824e1185103829008e317d6a68aa628 authored by dependabot[bot] on 03 March 2024, 01:33:37 UTC, committed by GitHub on 03 March 2024, 01:33:37 UTC
Bumps [trxgrep](https://github.com/kaby76/Domemtech.Trash) from 0.21.16 to 0.22.0.
- [Commits](https://github.com/kaby76/Domemtech.Trash/commits)

---
updated-dependencies:
- dependency-name: trxgrep
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent ab9ab66
Raw File
Tip revision: 3ba0d9b93824e1185103829008e317d6a68aa628 authored by dependabot[bot] on 03 March 2024, 01:33:37 UTC
Bump trxgrep from 0.21.16 to 0.22.0 (#3990)
Tip revision: 3ba0d9b
DiceNotationParser.g4
/**
 * Copyright 2014-2019 the original author or authors
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

/** 
 * Dice notation grammar.
 * 
 * This is the notation which RPGs and other tabletop games use to represent operations with dice.
 */

// $antlr-format alignTrailingComments true, columnLimit 150, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging

parser grammar DiceNotationParser;

options {
    tokenVocab = DiceNotationLexer;
}

/**
 * Rules.
 */

file_
    : notation EOF
    ;

notation
    : dice
    | number
    | addOp
    ;

addOp
    : multOp (ADDOPERATOR multOp)*
    ;

multOp
    : operand (MULTOPERATOR operand)*
    ;

operand
    : dice
    | number
    | LPAREN notation RPAREN
    ;

dice
    : ADDOPERATOR? DIGIT? DSEPARATOR DIGIT
    ;

number
    : ADDOPERATOR? DIGIT
    ;
back to top