packages/bison-parser/src/Ast/Declaration/Symbols/Associativity.php

1<?php
2
3declare(strict_types=1);
4
5namespace BisonParser\Ast\Declaration\Symbols;
6
7/**
8 * The four precedence directives: `%left`, `%right`, `%nonassoc` and `%precedence`.
9 *
10 * `%binary` is the deprecated spelling of `%nonassoc` and reads as it.
11 *
12 * @visibility public
13 *
14 * @example Telling the directives apart
15 *     \BisonParser\Ast\Declaration\Symbols\Associativity::from('nonassoc')->name // => 'NonAssoc'
16 */
17enum Associativity: string
18{
19    case Left = 'left';
20    case Right = 'right';
21    case NonAssoc = 'nonassoc';
22    case Precedence = 'precedence';
23}
24