Skip to content

Commit

Permalink
properly name note property lex tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
mgnsk committed May 18, 2023
1 parent 8e6964e commit 43a73d6
Show file tree
Hide file tree
Showing 8 changed files with 1,096 additions and 1,096 deletions.
14 changes: 7 additions & 7 deletions ast/note.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,22 @@ func (note *Note) IsPause() bool {

// NumSharp returns the number of sharp signs.
func (note *Note) NumSharp() int {
return note.countProps(tokentype.Sharp)
return note.countProps(tokentype.PropSharp)
}

// NumFlat reports the number of flat signs.
func (note *Note) NumFlat() int {
return note.countProps(tokentype.Flat)
return note.countProps(tokentype.PropFlat)
}

// NumAccents reports the number of accent properties in the note.
func (note *Note) NumAccents() int {
return note.countProps(tokentype.Accent)
return note.countProps(tokentype.PropAccent)
}

// NumGhosts reports the number of ghost properties in the note.
func (note *Note) NumGhosts() int {
return note.countProps(tokentype.Ghost)
return note.countProps(tokentype.PropGhost)
}

// Value returns the note value (1th, 2th, 4th, 8th, 16th, 32th and so on).
Expand All @@ -118,12 +118,12 @@ func (note *Note) Value() uint8 {

// NumDots reports the number of dot properties in the note.
func (note *Note) NumDots() int {
return note.countProps(tokentype.Dot)
return note.countProps(tokentype.PropDot)
}

// Tuplet returns the irregular division value if the note is a tuplet.
func (note *Note) Tuplet() int {
tok := note.Props.Find(tokentype.Tuplet)
tok := note.Props.Find(tokentype.PropTuplet)
if tok == nil {
return 0
}
Expand All @@ -137,7 +137,7 @@ func (note *Note) Tuplet() int {

// IsLetRing reports whether the note must ring.
func (note *Note) IsLetRing() bool {
return note.Props.Find(tokentype.LetRing) != nil
return note.Props.Find(tokentype.PropLetRing) != nil
}

func (note *Note) WriteTo(w io.Writer) (int64, error) {
Expand Down
2 changes: 1 addition & 1 deletion ast/property_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func NewPropertyList(t *token.Token, inner interface{}) (PropertyList, error) {
if err := validateNoteValue(v); err != nil {
return nil, err
}
case tokentype.Tuplet.Type:
case tokentype.PropTuplet.Type:
v, err := strconv.Atoi(string(t.Lit[1:]))
if err != nil {
return nil, err
Expand Down
32 changes: 16 additions & 16 deletions balafon.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ cmdStop : ':' 's' 't' 'o' 'p' ;
bracketBegin : '[' ;
bracketEnd : ']' ;

rest : '-' ;
sharp : '#' ;
flat : '$' ;
accent : '^' ;
ghost : ')' ;
dot : '.' ;
tuplet : '/' '3' | '/' '5' ;
letRing : '*' ;
propRest : '-' ;
propSharp : '#' ;
propFlat : '$' ;
propAccent : '^' ;
propGhost : ')' ;
propDot : '.' ;
propTuplet : '/' '3' | '/' '5' ;
propLetRing : '*' ;

_lineComment : '/' '/' { . } '\n' ;
_blockComment : '/' '*' { . | '*' } '*' '/' ;
Expand Down Expand Up @@ -97,7 +97,7 @@ NoteObject

NoteSymbol
: symbol
| rest
| propRest
;

PropertyList
Expand All @@ -106,14 +106,14 @@ PropertyList
;

Property
: sharp
| flat
| accent
| ghost
: propSharp
| propFlat
| propAccent
| propGhost
| uint
| dot
| tuplet
| letRing
| propDot
| propTuplet
| propLetRing
;

TopLevelCommand
Expand Down
Loading

0 comments on commit 43a73d6

Please sign in to comment.