Implementation of new parser

From Aikiframework wiki

Jump to: navigation, search

Concept

Parser for AIKI markup should be real recursive parser (no lame string substitution) it should parse things like this:

 (for( $aiki->utils->fn() as id {
   <div>
   (sql( SELECT * FROM table WHERE id = ((id)) {
      <div>
        <h1>Section 1</h1>
        (if( $aiki->utls->fn( ((some_filed)) ) {
           <div>((some_filed))</div>
           (*here id will be from first sql not from for loop*)
           (sql( SELECT * FROM other_table WHERE ((other_id)) = ((id)) {
              (if( $aiki->membership->username == '[username]' ||
                   $aiki->membership->permission == 'librarian'{
                 (*here id will be from last sql not from for loop nor first sql *)
                 (widget:delete_row( "other_table", ((id)) )widget)
              })if)
           })sql)
        })if)
        </h2>Section 2</h2>
        (if( $aiki->utls->file_exists( ((filename)) ) {
           (widget:show_file( ((filename)) )widget)
        }else{
           <div>Sorry no file</div>
        })if)
      </div>
   })sql)
   </div>
 })for)

No matter how deeply nested the markup will be it should handle it.


We should use parser generator for this job - PEG is nice grammar.

And after parsing it should evaluate the markup and return widget content.

References

Personal tools