Nav:  [home][ani][anivision] > [pov-grammar]
 
Go:  [ANI] [POV]
← [What are these? Why?]

AniVision: POV Command Comment Grammar

POV Scene File Scanner

The POVRay scene files read in by AniVision are not completely parsed but only scanned for special command comments which are normal C or C++-style comments when parsed by POVRay. The rules are as follows:

  • Command comments begin with //@ or /*@. There may be whitespace before the "@".
  • Comments beginning with //@- or /*@- are ignored. This is useful for quickly "commenting out" command comments.
  • C-style command comments (/*@) end when the matching */ is read.
  • C++-style command comments (//@) end at end of line unless
    (1) the brackts read so far are not balanced and
    (2) the next line contains only whitespace and a plain C++-style comment //.
  • A "@-" inside a command comment may be used to stop interpretation of the comment.
  • Command comments may contain plain C- and C++-style comments; the former may be nested.
  • Several "@"-specs (like @object(...)) may be supplied inside a single command comment.

Examples:

//@object(macro=something)  @object(macro2=something_else) @- ignored
// @object(macro=foo,  // comment
//   params={bar})     // comment
//@-object(macro=ignored)
/*@object(macro=foobar,  // comment
  params={a,b/*,c,d,e*/} // comment
  @- text ignored */

POV Command Comment Syntax in EBNF

POV Command comments have a context-free grammar which partly builds upon definitions from the animation description ANI grammar.

pov_exprlist ::=
	  /* empty */
	| pov_exprlist_ne .

pov_exprlist_ne ::=
	  pov_expr
	| pov_exprlist_ne "," pov_expr .

pov_expr ::= expr .

pov_assignment_list ::=
	  /*empty */
	| pov_assignment_list_ne .

pov_assignment_list_ne ::=
	  pov_assignment_list_ent
	| pov_assignment_list_ne "," pov_assignment_list_ent .

pov_assignment_list_ent ::= name "=" pov_expr .

/* Entry in POV @object() spec: */
pov_object_entry ::=
	  "macro" "=" name
	| "declare" "=" name
	| "params" "=" "{" pov_exprlist "}"
	| "defs" "=" "{" pov_assignment_list "}"
	| "include" "=" "{" pov_exprlist "}"
	| "type" "=" pov_expr
	| "append_raw" "=" pov_expr .

pov_object_entry_list ::=
	  pov_object_entry
	| pov_object_entry_list "," pov_object_entry .

/* POV command comment entry: */
pov_entry ::=
	  "@" TSP_OBJECT "(" pov_object_entry_list ")"
	| "@" TSP_FILEID "=" name .

pov_entry_list_ne ::=
	  pov_entry
	| pov_entry_list_ne pov_entry .

pov_entry_list ::=
	  /* empty */
	| pov_entry_list_ne .

START ::= pov_entry_list .

[home] [site map]
Valid HTML 4.01!
Copyright © 2003-2004 by Wolfgang Wieser
Last modified: 2004-05-15 20:29:21