Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with header field #1269

Closed
rpspringuel opened this issue Dec 31, 2016 · 9 comments
Closed

Problem with header field #1269

rpspringuel opened this issue Dec 31, 2016 · 9 comments

Comments

@rpspringuel
Copy link
Contributor

rpspringuel commented Dec 31, 2016

The transcription-date header field seems to be throwing errors now. The following file throws a error:syntax error using the most recent develop. Comment out the transcription-date line and the error disappears.

name: When Christ was born;
gabc-copyright:  (C) R. Padraic Springuel, This work is licensed under a Creative Commons Attribution 4.0 International License.;
office-part: Hymn;
occasion: Epiphany;
meter: 8.8.8.8;
arranger: Nicolas;
transcriber: Br. Samuel Springuel, OSB;
transcription-date: 20131231; 
mode: 2;

%%

(f3) When(f) Christ(f) was(f) born,(e) God(f) sent(h) a(g) star,(f_) (,)
A(h) sign(i) of(i) hope(i) whence(h) light(i) should(i) spring,(j.) (;)
And(j) Is(j)rael's(i) glo(j)ry(h) shine(i) for(h) all,(f_) (,)
For(f) pa(e)gan(f) and(h) for(i) pil(f)grim-(e)king.(f.) (::)
@henryso
Copy link
Contributor

henryso commented Dec 31, 2016

Using develop, I don't get an error when compiling that file to tex, nor when typesetting it with my boilerplate "main" .tex file. Is it possible your "main" .tex file is taking that field and doing something with it?

@rpspringuel
Copy link
Contributor Author

Did you uncomment the transcription-date line? It only throws the syntax error when that line is uncommented. Indeed, I'll edit my starting post to reflect that.

I'm using Gregorio 4.2.0-develop-7029d95e-4061 (which is latest develop) and the error is a rather uninformative error:syntax error.

@henryso
Copy link
Contributor

henryso commented Jan 1, 2017

Yes, I did uncomment that line. However, I hand typed (rather than copied) your sample. However, in copying your example, I have realized what the error is. There is a space after the semicolon on that line. I'll see what I can do about ignoring that space.

@henryso
Copy link
Contributor

henryso commented Jan 1, 2017

Because we support headers with embedded semicolons, such as:

book: Graduale Romanum, 1908, p. 249; Graduale Triplex, 1979, p. 253; Sg. 376 p. 296;

... I'm having trouble coming up with an appropriate expression to ignore the space, but I'll keep trying.

@rpspringuel
Copy link
Contributor Author

rpspringuel commented Jan 1, 2017

Wouldn't the regex for the end of the line be be something like: ;\s*(%.*)?$

@rpspringuel
Copy link
Contributor Author

Or perhaps we should modify the spec to say that if the header contains a semicolon, then it should be ended with a double one?

@henryso
Copy link
Contributor

henryso commented Jan 1, 2017

The problem is that I need to figure out a regular expression (actually a flex expression) that matches the stuff before the end-of-header sequence of characters.

@rpspringuel
Copy link
Contributor Author

Well, I think the following regex will match any valid header line: ^[^:]+: .*;[ \t]*(%.*)?$

I don't know much about flex expressions (just what a quick google search can tell me) but,
I think you could use the trailing context possibility to turn the above into something like this: ^[^:]+: .*/;[ \t]*(%.*)?$

In this case, the returned match will just be the header name and content. Everything after / (from the end of content ; to the end of the line (including the ;)) would not be returned as part of the match, but is used to determine if the match has been made. That is, if I understand what I've read correctly.

@henryso
Copy link
Contributor

henryso commented Jan 1, 2017

The parser matches with pieces of the header, not the entire header (which would then need to be parsed ... again ... for its parts). In any case, I think I've come up with a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants