Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed vim syntax file and parser for ranges. Added string back as an …

…implicit range of characters.
  • Loading branch information...
commit 3fb1cffee2243779d700d3e778b555b730604b28 1 parent f3b2290
@massung authored
Showing with 8 additions and 10 deletions.
  1. +1 −1  cell.ml
  2. +5 −8 parser.mly
  3. +2 −1  share/vim/syntax/ferret.vim
View
2  cell.ml
@@ -202,7 +202,7 @@ let proc_of_cell = function
let range_of_cell = function
| Range r -> r
| List xs -> new list_range xs
-(* | String s -> new range_t (new string_range s) (fun c -> Char c)*)
+ | String s -> new range_t (new string_range s) (fun c -> Char c)
| x -> raise (Type_error x)
(* coerce a cell to a reference *)
View
13 parser.mly
@@ -51,9 +51,6 @@ open Compile
%token FOR
%token FOREVER
%token FORK
-%token RANGE
-%token TO
-%token DOWNTO
%token BEGIN
%token END
%token TRUE
@@ -73,18 +70,18 @@ open Compile
/* binary and unary operators */
%token DOT SEND PLUS MINUS TIMES DIVIDE MOD
-%token AND OR EQ NE LT GT LE GE
+%token TO DOWNTO AND OR EQ NE LT GT LE GE
%token DEREF NOT PROBE RECEIVE REF
/* right associativity (lower precedence) */
%right FOREVER FORK REF DEREF PROBE NOT RECEIVE
/* left associativity */
-%left AND OR EQ NE LT GT LE GE
+%left AND OR EQ NE LT GT LE GE TO DOWNTO
%left DOT SEND PLUS MINUS TIMES DIVIDE MOD UMINUS
/* if .. then .. else associativity */
-%nonassoc IF THEN ELSE TO DOWNTO
+%nonassoc IF THEN ELSE
/* entry points */
%start package
@@ -172,6 +169,8 @@ expr:
| primary PAREN END_PAREN { call $1 0 }
/* binary expressions */
+ | expr TO expr { $1 >> $3 >> asm To }
+ | expr DOWNTO expr { $1 >> $3 >> asm Downto }
| expr AND expr { $1 >> $3 >> asm And }
| expr OR expr { $1 >> $3 >> asm Or }
| expr PLUS expr { $1 >> $3 >> asm Add }
@@ -186,8 +185,6 @@ expr:
| expr GT expr { $1 >> $3 >> asm Gt }
| expr LE expr { $1 >> $3 >> asm Le }
| expr GE expr { $1 >> $3 >> asm Ge }
- | expr TO expr { $1 >> $3 >> asm To }
- | expr DOWNTO expr { $1 >> $3 >> asm Downto }
/* unary expressions */
| MINUS expr %prec UMINUS { $2 >> asm Neg }
View
3  share/vim/syntax/ferret.vim
@@ -29,7 +29,8 @@ syn keyword ferretConstant true false none object
" Keywords
syn keyword ferretKeyword package from import let in
-syn keyword ferretKeyword with for to downto by forever fork do try
+syn keyword ferretKeyword for forever to downto
+syn keyword ferretKeyword with fork do try
syn keyword ferretKeyword when if then else begin end otherwise
syn keyword ferretKeyword and or not
syn keyword ferretKeyword make type ref fun
Please sign in to comment.
Something went wrong with that request. Please try again.