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

Handle characters in the parser. #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nomis52
Copy link
Member

@nomis52 nomis52 commented Jun 9, 2015

This means I can do things like

'a', 'b', 'c'

Also fix my misunderstanding of js regexs. This didn't cause a bug because we
match the entire line anyway.

This means I can do things like

'a', 'b', 'c'

Also fix my misunderstanding of js regexs. This didn't cause a bug because we
match the entire line anyway.

var char_match = token.match(/^'(.)'$/);
if (char_match) {
binary_data.push(char_match[1].charCodeAt());
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be

binary_data.push(char_match[1].charCodeAt(0));

Copy link
Member Author

Choose a reason for hiding this comment

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

Apparently 0 is the default.

I think I'm going to re-write the parser anyway.

@daveol
Copy link
Contributor

daveol commented Jun 10, 2015

LGTM, aside from a comment

@peternewman
Copy link
Member

Cool, I hit this stumbling block too.

@@ -340,20 +340,26 @@ angular.module('rdmApp', [])
var token = tokens[j];
var hex_suffix_match = token.match(/^([\da-fA-F]{1,2})h$/);
if (hex_suffix_match) {
binary_data.push(parseInt(hex_suffix_match[0], 16));
Copy link
Member

Choose a reason for hiding this comment

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

Can we have a comment at the top of this block reminding people of the broken way capture groups work in JS (it gets even messier if it's a global match with groups!

@peternewman
Copy link
Member

Only one comment from me.

application: "olp-rdm-staging"
#application: "rdmprotocol-hrd"
#application: "olp-rdm-staging"
application: "rdmprotocol-hrd"
Copy link
Member

Choose a reason for hiding this comment

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

Revert this

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.

None yet

3 participants