Skip to content

Instantly share code, notes, and snippets.

@Xliff
Created November 8, 2016 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xliff/fef6642960e6bccf67b3b842d9b71914 to your computer and use it in GitHub Desktop.
Save Xliff/fef6642960e6bccf67b3b842d9b71914 to your computer and use it in GitHub Desktop.

And, of course, there is something wrong.

Code:

use v6.c;

grammar XSLTFuncDef {
	TOP { 
		'XSLTPUBFUN' <ws>
		<returnType> <ws>
		'XSLTCALL' <ws>
		<funcName> <wso>
		'(' <params>* ');' 
	}

	token ws 	{ \s+ }
	token wso 	{ [ \s || \n ]* }

	token returnType {
		[const <ws>]? (\w+)
	}

	token funcName {
		\w+
	}

	token params {
		\w+ \w+,?
	}
}

my $test = "XSLTPUBFUN void XSLTCALL
	xsltApplyAttributeSet		(xsltTransformContextPtr ctxt,
					 xmlNodePtr node,
					 xmlNodePtr inst,
					 const xmlChar *attributes);";

my $t = XSLTFuncDef.parse($test);
say $t;

Yet when I compile this, I get:

===SORRY!=== Error while compiling /home/cbwood/projects/p6-xslt/gen/parser.pl
Two terms in a row
at /home/cbwood/projects/p6-xslt/gen/parser.pl:9
------>                 '(' <params>*⏏ ');'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment