@@ -25,7 +25,7 @@ using Windows who may not be aware, the `mv` (move) command creates a new copy
2525of a file and removes the original. `cc` is, of course, the C compiler and `cpp`
2626the C pre-processor.
2727
28- !images/ch_parser_build.jpg(Figure 1: Parser construction process)!
28+ !images/ch_parser_build.jpg(Parser construction process)!
2929
3030h3. Dissecting `parse.y`
3131
@@ -256,7 +256,7 @@ of this rule is demote an `expr` to a `primary`. This creates
256256a cycle which can the seen in Figure 2, and the arrow shows how this rule is
257257reduced during parsing.
258258
259- !images/ch_parser_exprloop.jpg(Figure 2: `expr` demotion)!
259+ !images/ch_parser_exprloop.jpg(`expr` demotion)!
260260
261261The next rule is also particularly interesting.
262262
@@ -270,7 +270,7 @@ primary : literal
270270A `compstmt`, which equals to the entire program (`program`), can be demoted to
271271a `primary` with this rule. The next figure illustrates this rule in action.
272272
273- !images/ch_parser_progloop.jpg(Figure 3: `program` demotion)!
273+ !images/ch_parser_progloop.jpg(`program` demotion)!
274274
275275This means that for any syntax element in Ruby, if we surround it with
276276parenthesis it will become a `primary` and can be passed as an argument to a
@@ -915,10 +915,7 @@ them are going to appear, replace them to a single `o` when they appear.
915915All we have to do is repeating this procedure.
916916Figure 4 shows the consequence.
917917
918- <p class="image">
919- <img src="images/ch_parser_ablist.jpg" alt="(ablist)"><br>
920- Figure 4: parse a list which starts with A and ends with B
921- </p>
918+ !images/ch_parser_ablist.jpg(parse a list which starts with A and ends with B)!
922919
923920
924921However, if the ending `B` is missing, ...
@@ -954,10 +951,7 @@ let's follow it as an experiment and parse the input
954951with shift (meaning interior) which takes precedence. (Figure 5)
955952
956953
957- <p class="image">
958- <img src="images/ch_parser_alist.jpg" alt="(alist)"><br>
959- Figure 5: parse a list of lists which start with A
960- </p>
954+ !images/ch_parser_alist.jpg(parse a list of lists which start with A)!
961955
962956
963957It could be parsed. However, this is completely different from the intention of
@@ -988,10 +982,7 @@ I'll explain about the outline of the parser before moving on to the scanner.
988982Take a look at Figure 6.
989983
990984
991- <p class="image">
992- <img src="images/ch_parser_interf.jpg" alt="(interf)"><br>
993- Figure 6: Parser Interface (Call Graph)
994- </p>
985+ !images/ch_parser_interf.jpg(Parser Interface (Call Graph))!
995986
996987
997988There are three official interfaces of the parser: `rb_compile_cstr()`,
@@ -1028,14 +1019,7 @@ and keeps them until it will form a token.
10281019Therefore, the whole structure of `yylex` can be depicted as Figure 7.
10291020
10301021
1031- <div class="image">
1032- <img src="images/ch_parser_scanner.jpg" alt="(scanner)"><br>
1033- Figure 7: The whole picture of the scanner
1034- * 入力バッファ input buffer
1035- * バイト列 byte sequence
1036- * トークンバッファ token buffer
1037- * 記号列 symbol sequence
1038- </div>
1022+ !images/ch_parser_scanner.jpg(The whole picture of the scanner)!
10391023
10401024
10411025
@@ -1066,7 +1050,7 @@ The beginning, the current position and the end of the buffer.
10661050Apparently, this buffer seems a simple single-line string buffer (Figure 8).
10671051
10681052
1069- !images/ch_parser_ibuffer.jpg(Figure 8: The input buffer)!
1053+ !images/ch_parser_ibuffer.jpg(The input buffer)!
10701054
10711055
10721056
@@ -1321,7 +1305,7 @@ This is also simply structured. If depicting it,
13211305it would look like Figure 9.
13221306
13231307
1324- !images/ch_parser_tbuffer.jpg(Figure 9: The token buffer)!
1308+ !images/ch_parser_tbuffer.jpg(The token buffer)!
13251309
13261310
13271311Let's continuously go to the interface and
@@ -2245,7 +2229,7 @@ The part which reads the starting symbol (`<<EOS`) is not important, so it is to
22452229Until now, the input buffer probably has become as depicted as Figure 10.
22462230Let's recall that the input buffer reads a line at a time.
22472231
2248- !images/ch_parser_lexparams.jpg(Figure 10: scanning `"printf\(<<EOS,n\)"`)!
2232+ !images/ch_parser_lexparams.jpg(scanning `"printf\(<<EOS,n\)"`)!
22492233
22502234
22512235What `heredoc_identifier()` is doing is as follows:<br>
@@ -2347,7 +2331,4 @@ It means it can continue to scan from the just after the starting symbol
23472331as if there was nothing happened. (Figure 11)
23482332
23492333
2350- <p class="image">
2351- <img src="images/ch_parser_heredoc.jpg" alt="(heredoc)"><br>
2352- Figure 11: The picture of assignation of scanning Here Document
2353- </p>
2334+ !images/ch_parser_heredoc.jpg(The picture of assignation of scanning Here Document)!
0 commit comments