Parse mode

Parse mode

  • When running server-side, run-time performance is critical, as any delays will be visible to the users. When compiling a site offline, performance is generally not a problem.
  • Thus it is important that the server-side actions be kept to a minimum. This usually involves two things when designing server-side hfl pages:
    • Compile as much of the page offline as possible, leaving only those parts that must be constructed server-side at run-time as HFL blocks.
    • Constrain the server-side execution to do as little construction as possible.
  • How much work the HFL compiler must do depends upon how much of the page it is asked to manipulate. When compiling offline, it is usually very desirable to have the compiler completely analyze and construct the pages. But when running server-side, this is usually far too expensive. So the two environments really require that the compiler focus on different things.
  • When running server-side, most of the source file should be treated as pure text, and only those portions that need to be constructed at display time should be seen by the HFL compiler.
  • This means that the HFL compiler needs to be configured to parse (break into meaningful pieces) the source file in two possible ways, or parse modes: 'full' or 'inline'.
  • The parse mode of the HFL compiler can be set using the 'mode' declaration:
  • SYNTAX:
  • mode: {full | inline};
    • The 'full' parse mode will build cell structure for all HTML and HFL tags, allowing full scope and editing control of the structure of the page. This is the default for offline compiling.
    • The 'inline' parse mode treats the bulk of the source file as just text, and only looks for and processes HFL tags. It's behavior in this mode is similar to that of PHP. This is the default for server-side processing.
    • 'mode' declarations can appear anywhere within the HFL source file, and will affect how the file is processed past that point.
    • There can be any number of 'mode' declarations in the file, allowing the mode to be toggled from one state to the other. This can be useful when it is necessary to control the structure of certain sections of an HTML file, while leaving the rest alone.
    • Note however that unless the entire file is parsed in 'full' mode, scope specifications will not be able to recognize the portions that were parsed as 'inline'.
Previous: The HFL Preprocessor Next: Tutorial