Skip to content

<Assignment> not recognized when followed by a integer #179

Description

@ArturJD96

Hello! Thank you for all this amazing stuff around!

I have identified a misbehaviour of lexer. When assignment is proceeded by a numeric, it is ignored by the lexer and is not reflected in the music document.

from ly.document import Document
from ly.music import document

str_INCORRECT_result = """
\\version "2.24.3"
\\include "def.ly"
numeric = 2 % this line messes up the lexer
assignment = \\relative c {
    a4
}
"""

str_correct_result = """
\\version "2.24.3"
\\include "def.ly"
numeric = "2"
assignment = \\relative c {
    a4
}
"""

d_correct = document(Document(str_correct_result))
d_INCORRECT = document(Document(str_INCORRECT_result))

print(d_correct.dump())
# <Document>
#   <Version '\\version'>
#     <String '"'>
#   <Include '\\include'>
#     <String '"'>
#   <Assignment 'numeric'>
#     <String '"'>
#   <Assignment 'assignment'> <-- CORRECT
#     <Relative '\\relative'>
#       <Note 'c'>
#       <MusicList '{'>
#         <Note 'a'>
#           <Duration '4'>

print(d_INCORRECT.dump())
# <Document>
#   <Version '\\version'>
#     <String '"'>
#   <Include '\\include'>
#     <String '"'>
#   <Assignment 'numeric'>
#     <Unpitched>
#       <Duration '2'>
#   <Relative '\\relative'> <-- NOT CORRECT – <Assignment> MISSING!
#     <Note 'c'>
#     <MusicList '{'>
#       <Note 'a'>
#         <Duration '4'>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions