org.jproggy.snippetory.engine.spi
Class CComments

java.lang.Object
  extended by org.jproggy.snippetory.engine.RegExSyntax
      extended by org.jproggy.snippetory.engine.spi.CComments
All Implemented Interfaces:
Syntax

public class CComments
extends RegExSyntax

C_COMMENTS syntax uses C comment areas and C++ line comments to hide template syntax from compilers and interpreters that might be used to validate the templates.
The template syntax is based on a leading $ sign and braces to mark the area of impact. On regions the name is repeated at the end, while pure locations simply close the curly bracket.
A special variant of the syntax allows mocking:
/*${name attrib="value"*/mock/*}*/;
The mock will be ignored and will not be written to the output. This supports to keep the template valid for execution or compilation as for the validation environment the mock is visible and substitutes data to be bound.
Line breaks are supported whitespace in C_COMMENTS but not within the mock.

Author:
B. Ebertz

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jproggy.snippetory.engine.RegExSyntax
RegExSyntax.RegexParser
 
Nested classes/interfaces inherited from interface org.jproggy.snippetory.spi.Syntax
Syntax.Registry, Syntax.Tokenizer
 
Field Summary
 
Fields inherited from class org.jproggy.snippetory.engine.RegExSyntax
ATTRIBUTE, ATTRIBUTES, CONTENT, ESCAPES, LINE_END, LINE_START, NAME, NAME_CHAR, NAME_START_CHAR, SYNTAX_SELECTOR
 
Fields inherited from interface org.jproggy.snippetory.spi.Syntax
REGISTRY
 
Constructor Summary
CComments()
           
 
Method Summary
 RegExSyntax.RegexParser parse(CharSequence data, TemplateContext ctx)
          transform input data to a stream of token.
 
Methods inherited from class org.jproggy.snippetory.engine.RegExSyntax
takeOver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CComments

public CComments()
Method Detail

parse

public RegExSyntax.RegexParser parse(CharSequence data,
                                     TemplateContext ctx)
Description copied from interface: Syntax
transform input data to a stream of token. Those tokens can be used by low level tools like the TemplateBuilder.

Specified by:
parse in interface Syntax
Specified by:
parse in class RegExSyntax
Parameters:
data - template to be parsed as character data.
Returns:
a tokenizer providing the token stream


Copyright © 2013. All Rights Reserved.