Results 0 - 10 of 28.

379 VIEWS

Ohcount does this (http://labs.ohloh.net). It's open source so you can contribute to it if you like.

2316 VIEWS

I implemented this over the summer; it appears to work fine for me, what seems to be the problem?

300 VIEWS

Feel free to write and submit a parser for it. It's much easier now!

939 VIEWS

That's what @enqueue and @commit are for.

919 VIEWS

The statement is not definitive, so I don't see what is wrong with it. Care to suggest an alternative comment?

939 VIEWS

I've called the language 'tag'. If it was C, then the line would be c_line; Ruby would be ruby_line, etc. I would pursue the solution given by Adrian on the Ragel mailing list though.

939 VIEWS

I've had mixed success with the following (maybe it will help): action mark_start { start = fpc + 1; //printf("Mark start at %c\n", fc); } action tagstart { size_t len = fpc - start; s = ... [More] calloc(len, sizeof(char)); strncpy(s, start, len); s[len] = '\0'; printf("Start: %s\n", s); } action tagend { size_t len = fpc - start; e = calloc(len, sizeof(char)); strncpy(e, start, len); e[len] = '\0'; printf("End: %s\n", e); } tag_comment_end := '/' @commit @comment @{ start = NULL; e = NULL; } @{ fgoto tag_line; }; tag_comment = '/' @mark_start (nonnewline - ws)* '/' @tagstart @comment @enqueue ( '/' @mark_start (nonnewline - ws)* '/' @tagend @{ if (e && s && strncmp(e, s, sizeof(s)) == 0) { fhold; fgoto tag_comment_end; } } | newline %{ entity = INTERNAL_NL; } %tag_ccallback | ws | ^space @comment )*; [Less]

939 VIEWS

I would try capturing the first /.../ and start the enqueueing process (@enqueue). Wrap and capture the delimitting /.../ in a 'when' statement comparing with the first capture. Outside of and after ... [More] the 'when' statement, commit the queue (@commit). Pseudocode: '/' @{ capture start of tag } whatever+ '/' @{ capture end of tag and get substring } @enqueue ( ... stuff ... )* :>> (('/' @{ capture start of delimitting tag } whatever+ '/' @{ capture end of delimitting tag and get substring}) when { substrings match }) @commit; [Less]

442 VIEWS

For length-specified comments, you can add @{} at the start and end points you are interested in and using the 'when' statement for when the difference in start and end positions is less than 20. ... [More] e.g. (untested) char *s, *e; %%{ comment = ('|' @{ s = p; } stuff* '#' @{ e = p; }) when { e - s < 20 }; %%} For nested expressions, look at the d.rl ragel parser. It has nested '/+ +/' comments that should help you. [Less]

11252 VIEWS

Robin, glad to hear you're implementing a framework rather than my quick hack for Mercurial support :)