Explorar el Código

Add future work note about unions in token type, and add
regexes.txt file for historical tracking.

Gustavo Niemeyer hace 13 años
padre
commit
523c7d9470
Se han modificado 2 ficheros con 52 adiciones y 0 borrados
  1. 48 0
      regexes.txt
  2. 4 0
      yaml_h.go

+ 48 - 0
regexes.txt

@@ -0,0 +1,48 @@
+
+/* A */  =>  // A
+
+	%s/\/\* \(.*\) \*\//\/\/ \1/gc
+
+A; [// B]  =>  A [// B]
+
+	%s/;[ \t]*\( \\/ .*\)\?$/\1/gc
+
+type [*]name  =>  name [*]type
+
+	%s/\(\%(\%(const\|unsigned\) \)\?\%(yaml_[a-z_]*_t\|\<int\>\|\<char\>\|\<size_t\>\)\) \(\**\)\([a-z_]\+\)/\3 \2\1/gc
+
+if (A) return B  =>  if A { return B }
+
+	%s/if (\(.*\)) return \([^ ]\+\)$/if \1 { return \2 }/gc
+
+if (A) {  =>  if A {
+
+	%s/if (\(.*\)) {$/if \1 {/gc
+
+if (A)\n{\n  =>  if A {\n
+
+	%s/\([ \t\/]*\)\(else\|if\)\( \)(\([^{]\+\))\n[ \t\/]*{$/\1\2\3\4 {/gc
+
+if (A)\nB  =>  if A {\nB\n}
+
+	%s/^\([ \t]*\/\/\)\?\( *\)if (\(.*\))\n\(.*\)/\1\2if \3 {^M\4^M\1\2}/gc
+
+if (A\nB) {  =>  if A\nB {
+
+	%s/\(if\|for\) (\(\_[^{]\+\)) {/\1 \2 {/gc
+
+}\nelse\n{  =>  } else {
+
+	%s/^\([ \t\/]*\)}\([ \t\/\n]*\)\n\1else\(\n\1\| \){/\1} else {/gc
+
+}\nelse if  =>  } else if
+
+	%s/^\([ \t\/]*\)}\([ \t\/\n]*\)\n\1else if/\1} else if/gc
+
+//static int\nyaml_*)\n//{  =>  //func yaml_*) bool {
+
+	%s/^\/\/\(static int\|YAML_DECLARE(int)\)\n\/\/\(yaml_\([^{]\+\n\?\)\+)\)\n\/\/{/\/\/func \2 bool {/gc
+
+IS_X_AT  =>  is_x
+
+	%s/IS_BLANKZ_AT(parser.buffer, \([0-9]\))/is_blankz(parser.buffer, parser.buffer_pos+\1)/

+ 4 - 0
yaml_h.go

@@ -196,6 +196,10 @@ type yaml_token_t struct {
 
 
 	// The token data.
 	// The token data.
 
 
+	// [Go] These structs should all be flattened onto the outer
+	// struct, as many of them are naturally shared among the various
+	// token types. This will reduce the impact of the lack of a union.
+
 	// The stream start (for yaml_STREAM_START_TOKEN).
 	// The stream start (for yaml_STREAM_START_TOKEN).
 	stream_start struct {
 	stream_start struct {
 		encoding yaml_encoding_t // The stream encoding.
 		encoding yaml_encoding_t // The stream encoding.