Commits

Toby Inkster  committed 4c5aeff

stringify tokens back to their original spelling

  • Participants
  • Parent commits 8c8fba7

Comments (0)

Files changed (2)

File examples/tokens.pl

 
 for my $tok (@{ $hl->tokenize(\$data) })
 {
-	say $tok;
+	print $tok;
 }
 
 __DATA__

File lib/Syntax/Highlight/RDF.pm

 
 {
 	no strict 'refs';
+	*{Token."::tok"} = sub {
+		sprintf "%s[%s]", $_[0]->TYPE, $_[0]->spelling
+	};
 	*{Token."::TO_STRING"} = sub {
-		sprintf "%s[%s]", $_[0]->TYPE, $_[0]->spelling
+		$_[0]->spelling
 	};
 	*{Token."::TO_HTML"}   = sub {
 		require HTML::HTML5::Entities;
 	);
 	$self->_tokens([]);
 	$self->_base($base // "http://www.example.net/");
-
+	
 	# Calculate these each time in case somebody wants to play with
 	# our variables!
 	my $_regexify = sub
 	my $sparqlAggregate = $_regexify->(@sparqlAggregate);
 	my $sparqlOrdering  = $_regexify->(@sparqlOrdering);
 	my $sparqlOperator  = $_regexify->(@sparqlOperator);
-
+	
 	# Don't need to repeatedly call this method!
 	my $IS_NTRIPLES    = $self->mode & MODE_NTRIPLES;
 	my $IS_TURTLE      = $self->mode & MODE_TURTLE;