Skip to content

Commit

Permalink
Describe lvar-injecting matches in AST_FORMAT (refs #69).
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Jun 16, 2013
1 parent 9e9b2e5 commit 6b75ff0
Showing 1 changed file with 37 additions and 30 deletions.
67 changes: 37 additions & 30 deletions doc/AST_FORMAT.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
AST and Source Location RFC
===========================

## Open questions:

* Should we handle these cases at all? They do not have special syntax associated.
1. How to handle lvar-injecting match (`if /(?<a>foo)/ =~ bar`)?

## Literals

### Singletons
Expand Down Expand Up @@ -363,31 +358,6 @@ Format:
~~~~~~~~~~~ expression
~~~

### Flip-flops

Format:

~~~
(iflipflop (lvar :a) (lvar :b))
"if a..b; end"
~~ operator
~~~~ expression
(eflipflop (lvar :a) (lvar :b))
"if a...b; end"
~~~ operator
~~~~~ expression
~~~

### Implicit matches

Format:

~~~
(match-current-line (regexp (str "a") (regopt)))
"if /a/; end"
~~~

## Assignment

### To local variable
Expand Down Expand Up @@ -1463,3 +1433,40 @@ Format:
~~~~~~~~~~~~~~~~~~ expression
~~~

## Miscellanea

### Flip-flops

Format:

~~~
(iflipflop (lvar :a) (lvar :b))
"if a..b; end"
~~ operator
~~~~ expression
(eflipflop (lvar :a) (lvar :b))
"if a...b; end"
~~~ operator
~~~~~ expression
~~~

### Implicit matches

Format:

~~~
(match-current-line (regexp (str "a") (regopt)))
"if /a/; end"
~~~

### Local variable injecting matches

Format:

~~~
(match-with-lvasgn (regexp (str "(?<match>bar)") (regopt)) (lvar :baz))
"/(?<match>bar)/ =~ baz"
~~ selector
~~~~~~~~~~~~~~~~~~~~~~ expression
~~~

0 comments on commit 6b75ff0

Please sign in to comment.