Skip to content

Conversation

@wamuir
Copy link
Contributor

@wamuir wamuir commented Feb 10, 2018

My read of the RELAX NG Compact Syntax spec indicates that two string literals should be concatenated when immediately surrounding a tilde. This is not currently supported by rnc2rng but could be useful. As one example, Appendix B to RFC 4278 (ATOM syndication) utilizes several tildes and concatenation would be expected. PR to include support in parser.py and add a simple test.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 89.815% when pulling 89290eb on wamuir:master into 27ec838 on djc:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 89.815% when pulling 89290eb on wamuir:master into 27ec838 on djc:master.

@coveralls
Copy link

coveralls commented Feb 10, 2018

Coverage Status

Coverage increased (+0.1%) to 89.815% when pulling 71fb313 on wamuir:master into 27ec838 on djc:master.

Copy link
Owner

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! This should definitely support ~, I just hadn't come across anything using it yet (and I may have missed it when reading the spec). I requested a few minor changes, are you up for making those? Otherwise I can just fix things up myself.

Additionally, I'd prefer to fold the first and last commits into the relevant other commits so I have nicer commit history, but I can take care of that easily if you don't want to get into that.

'LBRACE', 'LBRACKET', 'LPAREN', 'LIST', 'LITERAL', 'MINUS', 'MIXED',
'PLUS', 'PIPE', 'QMARK', 'RBRACE', 'RBRACKET', 'RPAREN', 'STAR', 'TILDE',
] + [s.upper() for s in KEYWORDS])
] + [s.upper() for s in KEYWORDS], precedence=[("left", ['TILDE'])])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the explicit precedence here actually needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think so. Although I'm not sure of a better way to avoid a conflict.


@pg.production('strlit : strlit TILDE strlit')
def primary_concat(s, p):
p[0].value = p[0].value + p[2].value
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing += here would be slightly nicer, I think, do you agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure!

@wamuir
Copy link
Contributor Author

wamuir commented Feb 11, 2018

Great, thanks! I made the operator change (left a comment on the first) and squashed commits.

@djc djc merged commit 213a824 into djc:master Feb 11, 2018
@djc
Copy link
Owner

djc commented Feb 11, 2018

Merged! I've also pushed a new release to PyPI, thanks.

I'd like to add you to the AUTHORS file if you don't mind passing me a real email address (or make a PR yourself).

@wamuir
Copy link
Contributor Author

wamuir commented Feb 11, 2018

Sure! Address is wamuir@gmail.com

@djc
Copy link
Owner

djc commented Feb 12, 2018

Added in d96073e.

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

Successfully merging this pull request may close these issues.

3 participants