Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Parse define-type decls.

  • Loading branch information...
commit 56717be05efb9e7e558855835357d6853694c8d6 1 parent 6a571f9
Ray Racine authored
Showing with 45 additions and 10 deletions.
  1. +31 −4 elisp/palm-tr-by.el
  2. +14 −6 elisp/palm-tr.by
35 elisp/palm-tr-by.el
View
@@ -3,7 +3,7 @@
;; Copyright (C) 2013 Raymond Paul Racine
;; Author: Ray <ray@rpr>
-;; Created: 2013-03-03 15:40:45-0500
+;; Created: 2013-03-04 23:15:14-0500
;; Keywords: syntax
;; X-RCS: $Id$
@@ -44,6 +44,7 @@
(semantic-lex-make-keyword-table
'(("lang" . LANG)
("only-in" . ONLY-IN)
+ ("define-type" . DEFINE-TYPE)
("require" . REQUIRE)
("define" . DEFINE))
'(("define" summary "Function: (define symbol expression)")))
@@ -149,10 +150,36 @@
(semantic-tag-new-include
(nth 1 vals) nil))
)
- (type-declaration)
+ (type-decl)
+ (typedefine-decl)
) ;; end racket-in-list
- (type-declaration
+ (typedefine-decl
+ (DEFINE-TYPE
+ symbol
+ semantic-list
+ ,(semantic-lambda
+ (semantic-tag-new-type
+ (nth 1 vals)
+ (car
+ (semantic-bovinate-from-nonterminal
+ (car
+ (nth 2 vals))
+ (cdr
+ (nth 2 vals))
+ 'type-sexp)) nil nil))
+ )
+ (DEFINE-TYPE
+ symbol
+ symbol
+ ,(semantic-lambda
+ (semantic-tag-new-type
+ (nth 1 vals)
+ (nth 2 vals) nil nil))
+ )
+ ) ;; end typedefine-decl
+
+ (type-decl
(punctuation
"\\`[:]\\'"
symbol
@@ -178,7 +205,7 @@
(car
(nth 2 vals)) nil nil))
)
- ) ;; end type-declaration
+ ) ;; end type-decl
(require-spec-seq
(require-spec
20 elisp/palm-tr.by
View
@@ -25,6 +25,7 @@
%token LANG "lang"
;; %token DEFINE "define"
%token ONLY-IN "only-in"
+%token DEFINE-TYPE "define-type"
%put DEFINE summary "Function: (define symbol expression)"
@@ -72,14 +73,21 @@ racket-in-list : DEFINE symbol semantic-list
nil))
| REQUIRE require-spec-seq
(INCLUDE-TAG $2 nil)
- | type-declaration
+ | type-decl
+ | typedefine-decl
;
-type-declaration : COLON symbol semantic-list
- (TYPE-TAG $2 (car (EXPAND $3 type-sexp)) nil nil)
- | COLON symbol type-expression
- (TYPE-TAG $2 (car $3) nil nil)
- ;
+typedefine-decl : DEFINE-TYPE symbol semantic-list
+ (TYPE-TAG $2 (car (EXPAND $3 type-sexp)) nil nil)
+ | DEFINE-TYPE symbol symbol
+ (TYPE-TAG $2 $3 nil nil)
+ ;
+
+type-decl : COLON symbol semantic-list
+ (TYPE-TAG $2 (car (EXPAND $3 type-sexp)) nil nil)
+ | COLON symbol type-expression
+ (TYPE-TAG $2 (car $3) nil nil)
+ ;
require-spec-seq : require-spec require-spec-seq
,(cons (car $1) $2)
Please sign in to comment.
Something went wrong with that request. Please try again.