grammatica-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Grammatica-users] Questions about Parsers


From: D. R. E. Moonfire
Subject: [Grammatica-users] Questions about Parsers
Date: Tue, 19 Apr 2005 14:46:30 -0500
User-agent: Debian Thunderbird 1.0.2 (X11/20050331)

I'm working on a little parser... okay, slightly larger than little, that handles a good-sized subset of a SQL DDL statement. Unfortunately, I'm getting into a mess with PL/SQL stuff.

In specific, I have a reasonably complicated trigger:

  CREATE OR REPLACE TRIGGER db.triggerref
  AFTER INSERT OR UPDATE OR DELETE
  ON tableref
  REFERENCING OLD AS OLD NEW AS NEW
  FOR EACH ROW
  DECLARE
     L_supplier       SUPS.SUPPLIER%TYPE;
     L_return         BOOLEAN;
  BEGIN
     L_addr.ADDR_KEY := :new.ADDR_KEY;
  END;

I have an identifier token:

  IDENTIFIER = <<[a-zA-Z_\$][a-zA-Z0-9_\$]+>>

And I'm trying to get everything into a single string, without bothering to write an entire PL/SQL grammar for Grammatica. Yeah, it would be great, but more work than I have time for. I tried creating a big token-like token

  ORACLE_CODE_BLOCK = <<REFERENCING.*?END;>>

It keeps wanting to refere to REFERENCING as an IDENTIFIER instead of ORACLE_CODE BLOCK. The production is:

  create_trigger
        = CREATE [OR REPLACE] TRIGGER ref
          (AFTER|BEFORE) trigger_op {OR trigger_op}
          ON table_ref
          ORACLE_CODE_BLOCK
        ;

Am I doing something completely wrong?

Also, thanks for a great parser. I actually ended up making a Debian package out of it because I was using it so much. Had to use the 1.5 version just to get the case insensitive stuff.

Cheers!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]