mkrf 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +2 -0
- data/MIT-LICENSE +7 -0
- data/README +54 -0
- data/Rakefile +107 -0
- data/lib/mkrf.rb +4 -0
- data/lib/mkrf/availability.rb +219 -0
- data/lib/mkrf/generator.rb +146 -0
- data/test/abstract_unit.rb +4 -0
- data/test/fixtures/down_a_directory/header_down_a_directory.h +1 -0
- data/test/fixtures/stdmkrf.h +1 -0
- data/test/sample_files/libtrivial/Rakefile +31 -0
- data/test/sample_files/libtrivial/extconf.rb +3 -0
- data/test/sample_files/libtrivial/lib/libtrivial.c +5 -0
- data/test/sample_files/libtrivial/lib/libtrivial.o +0 -0
- data/test/sample_files/libtrivial/libtrivial_so.bundle +0 -0
- data/test/sample_files/libtrivial/mkrf.log +1 -0
- data/test/sample_files/libxml-ruby-0.3.8/CHANGELOG +74 -0
- data/test/sample_files/libxml-ruby-0.3.8/LICENSE +22 -0
- data/test/sample_files/libxml-ruby-0.3.8/README +144 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/cbg.c +76 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/extconf.rb +49 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.c +86 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.h +82 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.rb +107 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/mkrf.log +1 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/old_extconf.rb +95 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attr.c +372 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attr.h +21 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attribute.c +224 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attribute.h +21 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.c +1159 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.h +27 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_dtd.c +168 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_dtd.h +17 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_input_cbg.c +167 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_input_cbg.h +21 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node.c +2139 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node.h +28 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node_set.c +248 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node_set.h +26 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_ns.c +153 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_ns.h +21 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.c +1417 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.h +31 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser_context.c +715 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser_context.h +22 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_sax_parser.c +426 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_sax_parser.h +52 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_schema.c +142 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_schema.h +16 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_tree.c +43 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_tree.h +12 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xinclude.c +20 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xinclude.h +13 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.c +363 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.h +24 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath_context.c +125 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath_context.h +24 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer.c +100 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer.h +27 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer_context.c +21 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer_context.h +18 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/sax_parser_callbacks.inc +202 -0
- data/test/sample_files/syck-0.55/CHANGELOG +186 -0
- data/test/sample_files/syck-0.55/COPYING +54 -0
- data/test/sample_files/syck-0.55/Makefile +582 -0
- data/test/sample_files/syck-0.55/Makefile.am +5 -0
- data/test/sample_files/syck-0.55/Makefile.in +582 -0
- data/test/sample_files/syck-0.55/README +105 -0
- data/test/sample_files/syck-0.55/README.BYTECODE +484 -0
- data/test/sample_files/syck-0.55/README.EXT +444 -0
- data/test/sample_files/syck-0.55/RELEASE +123 -0
- data/test/sample_files/syck-0.55/TODO +25 -0
- data/test/sample_files/syck-0.55/aclocal.m4 +883 -0
- data/test/sample_files/syck-0.55/bootstrap +7 -0
- data/test/sample_files/syck-0.55/config.h +79 -0
- data/test/sample_files/syck-0.55/config.h.in +78 -0
- data/test/sample_files/syck-0.55/config.status +1197 -0
- data/test/sample_files/syck-0.55/config/README +14 -0
- data/test/sample_files/syck-0.55/config/depcomp +529 -0
- data/test/sample_files/syck-0.55/config/install-sh +323 -0
- data/test/sample_files/syck-0.55/config/missing +357 -0
- data/test/sample_files/syck-0.55/configure +6728 -0
- data/test/sample_files/syck-0.55/configure.in +36 -0
- data/test/sample_files/syck-0.55/ext/ruby/CHANGELOG +303 -0
- data/test/sample_files/syck-0.55/ext/ruby/README +400 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/MANIFEST +1 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/bytecode.c +1170 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/emitter.c +1224 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/extconf.rb +10 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/gram.c +1894 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/gram.h +79 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/handler.c +174 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/implicit.c +2989 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/mkrf.log +1 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/node.c +407 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/rubyext.c +2385 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/syck.c +504 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/syck.h +458 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/token.c +2707 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/yaml2byte.c +250 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/yamlbyte.h +170 -0
- data/test/sample_files/syck-0.55/ext/ruby/install.rb +1022 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/okay.rb +161 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/okay/news.rb +69 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/okay/rpc.rb +434 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml.rb +436 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/baseemitter.rb +247 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/basenode.rb +216 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/compat.rb +26 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/constants.rb +45 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/dbm.rb +111 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/emitter.rb +107 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/encoding.rb +33 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/error.rb +34 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/rubytypes.rb +438 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/store.rb +29 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/stream.rb +40 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/stringio.rb +83 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/syck.rb +19 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/tag.rb +86 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/types.rb +188 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/yamlnode.rb +54 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/ypath.rb +52 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yod.rb +1168 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-modules.rb +27 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-sample.rb +336 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-validate.rb +341 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/okayRpc-client.rb +51 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/okayRpc-server.rb +85 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/yaml-sortHashKeys.rb +128 -0
- data/test/sample_files/syck-0.55/ext/ruby/tests/basic.rb +1653 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsAnchorAlias.yml +51 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBasicTests.yml +282 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBlockMapping.yml +78 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBlockSequence.yml +0 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsDocumentSeparator.yml +102 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsErrorTests.yml +23 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsFlowCollections.yml +73 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsFoldedScalars.yml +215 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsMapInSeq.yml +0 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsNullsAndEmpties.yml +66 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsRubyTests.yml +182 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsSpecificationExamples.yml +2699 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsTypeTransfers.yml +265 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsYpath.yml +221 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/cookbook.rb +159 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/index.yml +10 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/yts.rb +193 -0
- data/test/sample_files/syck-0.55/lib/Makefile +497 -0
- data/test/sample_files/syck-0.55/lib/Makefile.am +27 -0
- data/test/sample_files/syck-0.55/lib/Makefile.in +497 -0
- data/test/sample_files/syck-0.55/lib/bytecode.c +1170 -0
- data/test/sample_files/syck-0.55/lib/bytecode.re +525 -0
- data/test/sample_files/syck-0.55/lib/emitter.c +1224 -0
- data/test/sample_files/syck-0.55/lib/gram.c +1894 -0
- data/test/sample_files/syck-0.55/lib/gram.h +79 -0
- data/test/sample_files/syck-0.55/lib/gram.output +2005 -0
- data/test/sample_files/syck-0.55/lib/gram.y +481 -0
- data/test/sample_files/syck-0.55/lib/handler.c +174 -0
- data/test/sample_files/syck-0.55/lib/implicit.c +2989 -0
- data/test/sample_files/syck-0.55/lib/implicit.re +206 -0
- data/test/sample_files/syck-0.55/lib/node.c +407 -0
- data/test/sample_files/syck-0.55/lib/syck.c +504 -0
- data/test/sample_files/syck-0.55/lib/syck.h +458 -0
- data/test/sample_files/syck-0.55/lib/syck_st.c +577 -0
- data/test/sample_files/syck-0.55/lib/syck_st.h +46 -0
- data/test/sample_files/syck-0.55/lib/token.c +2707 -0
- data/test/sample_files/syck-0.55/lib/token.re +1139 -0
- data/test/sample_files/syck-0.55/lib/yaml2byte.c +250 -0
- data/test/sample_files/syck-0.55/lib/yamlbyte.h +170 -0
- data/test/sample_files/syck-0.55/stamp-h1 +1 -0
- data/test/sample_files/syck-0.55/tests/Basic.c +141 -0
- data/test/sample_files/syck-0.55/tests/CuTest.c +294 -0
- data/test/sample_files/syck-0.55/tests/CuTest.h +84 -0
- data/test/sample_files/syck-0.55/tests/Emit.c +87 -0
- data/test/sample_files/syck-0.55/tests/Makefile +480 -0
- data/test/sample_files/syck-0.55/tests/Makefile.am +13 -0
- data/test/sample_files/syck-0.55/tests/Makefile.in +480 -0
- data/test/sample_files/syck-0.55/tests/Parse.c +208 -0
- data/test/sample_files/syck-0.55/tests/YTS.c +2310 -0
- data/test/sample_files/syck-0.55/tests/YTS.c.erb +326 -0
- data/test/sample_files/syck-0.55/tests/YTS.c.rb +44 -0
- data/test/test_availability.rb +68 -0
- data/test/test_generator.rb +74 -0
- metadata +252 -0
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* gram.y
|
|
3
|
+
*
|
|
4
|
+
* $Author: why $
|
|
5
|
+
* $Date: 2005/04/13 06:27:54 $
|
|
6
|
+
*
|
|
7
|
+
* Copyright (C) 2003 why the lucky stiff
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
%start doc
|
|
11
|
+
%pure-parser
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
%{
|
|
15
|
+
|
|
16
|
+
#include "syck.h"
|
|
17
|
+
|
|
18
|
+
void apply_seq_in_map( SyckParser *parser, SyckNode *n );
|
|
19
|
+
|
|
20
|
+
#define YYPARSE_PARAM parser
|
|
21
|
+
#define YYLEX_PARAM parser
|
|
22
|
+
|
|
23
|
+
#define NULL_NODE(parser, node) \
|
|
24
|
+
SyckNode *node = syck_new_str( "", scalar_plain ); \
|
|
25
|
+
if ( ((SyckParser *)parser)->taguri_expansion == 1 ) \
|
|
26
|
+
{ \
|
|
27
|
+
node->type_id = syck_taguri( YAML_DOMAIN, "null", 4 ); \
|
|
28
|
+
} \
|
|
29
|
+
else \
|
|
30
|
+
{ \
|
|
31
|
+
node->type_id = syck_strndup( "null", 4 ); \
|
|
32
|
+
}
|
|
33
|
+
%}
|
|
34
|
+
|
|
35
|
+
%union {
|
|
36
|
+
SYMID nodeId;
|
|
37
|
+
SyckNode *nodeData;
|
|
38
|
+
char *name;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
%token <name> YAML_ANCHOR YAML_ALIAS YAML_TRANSFER YAML_TAGURI YAML_ITRANSFER
|
|
42
|
+
%token <nodeData> YAML_WORD YAML_PLAIN YAML_BLOCK
|
|
43
|
+
%token YAML_DOCSEP YAML_IOPEN YAML_INDENT YAML_IEND
|
|
44
|
+
|
|
45
|
+
%type <nodeId> doc basic_seq
|
|
46
|
+
%type <nodeData> atom word_rep ind_rep struct_rep atom_or_empty empty
|
|
47
|
+
%type <nodeData> implicit_seq inline_seq implicit_map inline_map inline_seq_atom inline_map_atom
|
|
48
|
+
%type <nodeData> top_imp_seq in_implicit_seq in_inline_seq basic_mapping complex_key complex_value
|
|
49
|
+
%type <nodeData> top_imp_map in_implicit_map in_inline_map complex_mapping
|
|
50
|
+
|
|
51
|
+
%left '-' ':'
|
|
52
|
+
%left '[' ']' '{' '}' ',' '?'
|
|
53
|
+
|
|
54
|
+
%%
|
|
55
|
+
|
|
56
|
+
doc : atom
|
|
57
|
+
{
|
|
58
|
+
((SyckParser *)parser)->root = syck_hdlr_add_node( (SyckParser *)parser, $1 );
|
|
59
|
+
}
|
|
60
|
+
| YAML_DOCSEP atom_or_empty
|
|
61
|
+
{
|
|
62
|
+
((SyckParser *)parser)->root = syck_hdlr_add_node( (SyckParser *)parser, $2 );
|
|
63
|
+
}
|
|
64
|
+
|
|
|
65
|
+
{
|
|
66
|
+
((SyckParser *)parser)->eof = 1;
|
|
67
|
+
}
|
|
68
|
+
;
|
|
69
|
+
|
|
70
|
+
atom : word_rep
|
|
71
|
+
| ind_rep
|
|
72
|
+
;
|
|
73
|
+
|
|
74
|
+
ind_rep : struct_rep
|
|
75
|
+
| YAML_TRANSFER ind_rep
|
|
76
|
+
{
|
|
77
|
+
syck_add_transfer( $1, $2, ((SyckParser *)parser)->taguri_expansion );
|
|
78
|
+
$$ = $2;
|
|
79
|
+
}
|
|
80
|
+
| YAML_TAGURI ind_rep
|
|
81
|
+
{
|
|
82
|
+
syck_add_transfer( $1, $2, 0 );
|
|
83
|
+
$$ = $2;
|
|
84
|
+
}
|
|
85
|
+
| YAML_ANCHOR ind_rep
|
|
86
|
+
{
|
|
87
|
+
/*
|
|
88
|
+
* _Anchors_: The language binding must keep a separate symbol table
|
|
89
|
+
* for anchors. The actual ID in the symbol table is returned to the
|
|
90
|
+
* higher nodes, though.
|
|
91
|
+
*/
|
|
92
|
+
$$ = syck_hdlr_add_anchor( (SyckParser *)parser, $1, $2 );
|
|
93
|
+
}
|
|
94
|
+
| indent_open ind_rep indent_flex_end
|
|
95
|
+
{
|
|
96
|
+
$$ = $2;
|
|
97
|
+
}
|
|
98
|
+
;
|
|
99
|
+
|
|
100
|
+
atom_or_empty : atom
|
|
101
|
+
| empty
|
|
102
|
+
;
|
|
103
|
+
|
|
104
|
+
empty : indent_open empty indent_end
|
|
105
|
+
{
|
|
106
|
+
$$ = $2;
|
|
107
|
+
}
|
|
108
|
+
|
|
|
109
|
+
{
|
|
110
|
+
NULL_NODE( parser, n );
|
|
111
|
+
$$ = n;
|
|
112
|
+
}
|
|
113
|
+
| YAML_ITRANSFER empty
|
|
114
|
+
{
|
|
115
|
+
if ( ((SyckParser *)parser)->implicit_typing == 1 )
|
|
116
|
+
{
|
|
117
|
+
try_tag_implicit( $2, ((SyckParser *)parser)->taguri_expansion );
|
|
118
|
+
}
|
|
119
|
+
$$ = $2;
|
|
120
|
+
}
|
|
121
|
+
| YAML_TRANSFER empty
|
|
122
|
+
{
|
|
123
|
+
syck_add_transfer( $1, $2, ((SyckParser *)parser)->taguri_expansion );
|
|
124
|
+
$$ = $2;
|
|
125
|
+
}
|
|
126
|
+
| YAML_TAGURI empty
|
|
127
|
+
{
|
|
128
|
+
syck_add_transfer( $1, $2, 0 );
|
|
129
|
+
$$ = $2;
|
|
130
|
+
}
|
|
131
|
+
| YAML_ANCHOR empty
|
|
132
|
+
{
|
|
133
|
+
/*
|
|
134
|
+
* _Anchors_: The language binding must keep a separate symbol table
|
|
135
|
+
* for anchors. The actual ID in the symbol table is returned to the
|
|
136
|
+
* higher nodes, though.
|
|
137
|
+
*/
|
|
138
|
+
$$ = syck_hdlr_add_anchor( (SyckParser *)parser, $1, $2 );
|
|
139
|
+
}
|
|
140
|
+
;
|
|
141
|
+
|
|
142
|
+
/*
|
|
143
|
+
* Indentation abstractions
|
|
144
|
+
*/
|
|
145
|
+
indent_open : YAML_IOPEN
|
|
146
|
+
| indent_open YAML_INDENT
|
|
147
|
+
;
|
|
148
|
+
|
|
149
|
+
indent_end : YAML_IEND
|
|
150
|
+
;
|
|
151
|
+
|
|
152
|
+
indent_sep : YAML_INDENT
|
|
153
|
+
;
|
|
154
|
+
|
|
155
|
+
indent_flex_end : YAML_IEND
|
|
156
|
+
| indent_sep indent_flex_end
|
|
157
|
+
;
|
|
158
|
+
|
|
159
|
+
/*
|
|
160
|
+
* Words are broken out to distinguish them
|
|
161
|
+
* as keys in implicit maps and valid elements
|
|
162
|
+
* for the inline structures
|
|
163
|
+
*/
|
|
164
|
+
word_rep : YAML_TRANSFER word_rep
|
|
165
|
+
{
|
|
166
|
+
syck_add_transfer( $1, $2, ((SyckParser *)parser)->taguri_expansion );
|
|
167
|
+
$$ = $2;
|
|
168
|
+
}
|
|
169
|
+
| YAML_TAGURI word_rep
|
|
170
|
+
{
|
|
171
|
+
syck_add_transfer( $1, $2, 0 );
|
|
172
|
+
$$ = $2;
|
|
173
|
+
}
|
|
174
|
+
| YAML_ITRANSFER word_rep
|
|
175
|
+
{
|
|
176
|
+
if ( ((SyckParser *)parser)->implicit_typing == 1 )
|
|
177
|
+
{
|
|
178
|
+
try_tag_implicit( $2, ((SyckParser *)parser)->taguri_expansion );
|
|
179
|
+
}
|
|
180
|
+
$$ = $2;
|
|
181
|
+
}
|
|
182
|
+
| YAML_ANCHOR word_rep
|
|
183
|
+
{
|
|
184
|
+
$$ = syck_hdlr_add_anchor( (SyckParser *)parser, $1, $2 );
|
|
185
|
+
}
|
|
186
|
+
| YAML_ALIAS
|
|
187
|
+
{
|
|
188
|
+
/*
|
|
189
|
+
* _Aliases_: The anchor symbol table is scanned for the anchor name.
|
|
190
|
+
* The anchor's ID in the language's symbol table is returned.
|
|
191
|
+
*/
|
|
192
|
+
$$ = syck_hdlr_get_anchor( (SyckParser *)parser, $1 );
|
|
193
|
+
}
|
|
194
|
+
| YAML_WORD
|
|
195
|
+
{
|
|
196
|
+
SyckNode *n = $1;
|
|
197
|
+
if ( ((SyckParser *)parser)->taguri_expansion == 1 )
|
|
198
|
+
{
|
|
199
|
+
n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 );
|
|
200
|
+
}
|
|
201
|
+
else
|
|
202
|
+
{
|
|
203
|
+
n->type_id = syck_strndup( "str", 3 );
|
|
204
|
+
}
|
|
205
|
+
$$ = n;
|
|
206
|
+
}
|
|
207
|
+
| YAML_PLAIN
|
|
208
|
+
| indent_open word_rep indent_flex_end
|
|
209
|
+
{
|
|
210
|
+
$$ = $2;
|
|
211
|
+
}
|
|
212
|
+
;
|
|
213
|
+
|
|
214
|
+
/*
|
|
215
|
+
* Any of these structures can be used as
|
|
216
|
+
* complex keys
|
|
217
|
+
*/
|
|
218
|
+
struct_rep : YAML_BLOCK
|
|
219
|
+
| implicit_seq
|
|
220
|
+
| inline_seq
|
|
221
|
+
| implicit_map
|
|
222
|
+
| inline_map
|
|
223
|
+
;
|
|
224
|
+
|
|
225
|
+
/*
|
|
226
|
+
* Implicit sequence
|
|
227
|
+
*/
|
|
228
|
+
implicit_seq : indent_open top_imp_seq indent_end
|
|
229
|
+
{
|
|
230
|
+
$$ = $2;
|
|
231
|
+
}
|
|
232
|
+
| indent_open in_implicit_seq indent_end
|
|
233
|
+
{
|
|
234
|
+
$$ = $2;
|
|
235
|
+
}
|
|
236
|
+
;
|
|
237
|
+
|
|
238
|
+
basic_seq : '-' atom_or_empty
|
|
239
|
+
{
|
|
240
|
+
$$ = syck_hdlr_add_node( (SyckParser *)parser, $2 );
|
|
241
|
+
}
|
|
242
|
+
;
|
|
243
|
+
|
|
244
|
+
top_imp_seq : YAML_TRANSFER indent_sep in_implicit_seq
|
|
245
|
+
{
|
|
246
|
+
syck_add_transfer( $1, $3, ((SyckParser *)parser)->taguri_expansion );
|
|
247
|
+
$$ = $3;
|
|
248
|
+
}
|
|
249
|
+
| YAML_TRANSFER top_imp_seq
|
|
250
|
+
{
|
|
251
|
+
syck_add_transfer( $1, $2, ((SyckParser *)parser)->taguri_expansion );
|
|
252
|
+
$$ = $2;
|
|
253
|
+
}
|
|
254
|
+
| YAML_TAGURI indent_sep in_implicit_seq
|
|
255
|
+
{
|
|
256
|
+
syck_add_transfer( $1, $3, 0 );
|
|
257
|
+
$$ = $3;
|
|
258
|
+
}
|
|
259
|
+
| YAML_TAGURI top_imp_seq
|
|
260
|
+
{
|
|
261
|
+
syck_add_transfer( $1, $2, 0 );
|
|
262
|
+
$$ = $2;
|
|
263
|
+
}
|
|
264
|
+
| YAML_ANCHOR indent_sep in_implicit_seq
|
|
265
|
+
{
|
|
266
|
+
$$ = syck_hdlr_add_anchor( (SyckParser *)parser, $1, $3 );
|
|
267
|
+
}
|
|
268
|
+
| YAML_ANCHOR top_imp_seq
|
|
269
|
+
{
|
|
270
|
+
$$ = syck_hdlr_add_anchor( (SyckParser *)parser, $1, $2 );
|
|
271
|
+
}
|
|
272
|
+
;
|
|
273
|
+
|
|
274
|
+
in_implicit_seq : basic_seq
|
|
275
|
+
{
|
|
276
|
+
$$ = syck_new_seq( $1 );
|
|
277
|
+
}
|
|
278
|
+
| in_implicit_seq indent_sep basic_seq
|
|
279
|
+
{
|
|
280
|
+
syck_seq_add( $1, $3 );
|
|
281
|
+
$$ = $1;
|
|
282
|
+
}
|
|
283
|
+
| in_implicit_seq indent_sep
|
|
284
|
+
{
|
|
285
|
+
$$ = $1;
|
|
286
|
+
}
|
|
287
|
+
;
|
|
288
|
+
|
|
289
|
+
/*
|
|
290
|
+
* Inline sequences
|
|
291
|
+
*/
|
|
292
|
+
inline_seq : '[' in_inline_seq ']'
|
|
293
|
+
{
|
|
294
|
+
$$ = $2;
|
|
295
|
+
}
|
|
296
|
+
| '[' ']'
|
|
297
|
+
{
|
|
298
|
+
$$ = syck_alloc_seq();
|
|
299
|
+
}
|
|
300
|
+
;
|
|
301
|
+
|
|
302
|
+
in_inline_seq : inline_seq_atom
|
|
303
|
+
{
|
|
304
|
+
$$ = syck_new_seq( syck_hdlr_add_node( (SyckParser *)parser, $1 ) );
|
|
305
|
+
}
|
|
306
|
+
| in_inline_seq ',' inline_seq_atom
|
|
307
|
+
{
|
|
308
|
+
syck_seq_add( $1, syck_hdlr_add_node( (SyckParser *)parser, $3 ) );
|
|
309
|
+
$$ = $1;
|
|
310
|
+
}
|
|
311
|
+
;
|
|
312
|
+
|
|
313
|
+
inline_seq_atom : atom
|
|
314
|
+
| basic_mapping
|
|
315
|
+
;
|
|
316
|
+
|
|
317
|
+
/*
|
|
318
|
+
* Implicit maps
|
|
319
|
+
*/
|
|
320
|
+
implicit_map : indent_open top_imp_map indent_end
|
|
321
|
+
{
|
|
322
|
+
apply_seq_in_map( (SyckParser *)parser, $2 );
|
|
323
|
+
$$ = $2;
|
|
324
|
+
}
|
|
325
|
+
| indent_open in_implicit_map indent_end
|
|
326
|
+
{
|
|
327
|
+
apply_seq_in_map( (SyckParser *)parser, $2 );
|
|
328
|
+
$$ = $2;
|
|
329
|
+
}
|
|
330
|
+
;
|
|
331
|
+
|
|
332
|
+
top_imp_map : YAML_TRANSFER indent_sep in_implicit_map
|
|
333
|
+
{
|
|
334
|
+
syck_add_transfer( $1, $3, ((SyckParser *)parser)->taguri_expansion );
|
|
335
|
+
$$ = $3;
|
|
336
|
+
}
|
|
337
|
+
| YAML_TRANSFER top_imp_map
|
|
338
|
+
{
|
|
339
|
+
syck_add_transfer( $1, $2, ((SyckParser *)parser)->taguri_expansion );
|
|
340
|
+
$$ = $2;
|
|
341
|
+
}
|
|
342
|
+
| YAML_TAGURI indent_sep in_implicit_map
|
|
343
|
+
{
|
|
344
|
+
syck_add_transfer( $1, $3, 0 );
|
|
345
|
+
$$ = $3;
|
|
346
|
+
}
|
|
347
|
+
| YAML_TAGURI top_imp_map
|
|
348
|
+
{
|
|
349
|
+
syck_add_transfer( $1, $2, 0 );
|
|
350
|
+
$$ = $2;
|
|
351
|
+
}
|
|
352
|
+
| YAML_ANCHOR indent_sep in_implicit_map
|
|
353
|
+
{
|
|
354
|
+
$$ = syck_hdlr_add_anchor( (SyckParser *)parser, $1, $3 );
|
|
355
|
+
}
|
|
356
|
+
| YAML_ANCHOR top_imp_map
|
|
357
|
+
{
|
|
358
|
+
$$ = syck_hdlr_add_anchor( (SyckParser *)parser, $1, $2 );
|
|
359
|
+
}
|
|
360
|
+
;
|
|
361
|
+
|
|
362
|
+
complex_key : word_rep
|
|
363
|
+
| '?' atom indent_sep
|
|
364
|
+
{
|
|
365
|
+
$$ = $2;
|
|
366
|
+
}
|
|
367
|
+
;
|
|
368
|
+
|
|
369
|
+
complex_value : atom_or_empty
|
|
370
|
+
;
|
|
371
|
+
|
|
372
|
+
/* Default needs to be added to SyckSeq i think...
|
|
373
|
+
| '=' ':' atom
|
|
374
|
+
{
|
|
375
|
+
result = [ :DEFAULT, val[2] ]
|
|
376
|
+
}
|
|
377
|
+
*/
|
|
378
|
+
|
|
379
|
+
complex_mapping : complex_key ':' complex_value
|
|
380
|
+
{
|
|
381
|
+
$$ = syck_new_map(
|
|
382
|
+
syck_hdlr_add_node( (SyckParser *)parser, $1 ),
|
|
383
|
+
syck_hdlr_add_node( (SyckParser *)parser, $3 ) );
|
|
384
|
+
}
|
|
385
|
+
/*
|
|
386
|
+
| '?' atom
|
|
387
|
+
{
|
|
388
|
+
NULL_NODE( parser, n );
|
|
389
|
+
$$ = syck_new_map(
|
|
390
|
+
syck_hdlr_add_node( (SyckParser *)parser, $2 ),
|
|
391
|
+
syck_hdlr_add_node( (SyckParser *)parser, n ) );
|
|
392
|
+
}
|
|
393
|
+
*/
|
|
394
|
+
;
|
|
395
|
+
|
|
396
|
+
in_implicit_map : complex_mapping
|
|
397
|
+
| in_implicit_map indent_sep basic_seq
|
|
398
|
+
{
|
|
399
|
+
if ( $1->shortcut == NULL )
|
|
400
|
+
{
|
|
401
|
+
$1->shortcut = syck_new_seq( $3 );
|
|
402
|
+
}
|
|
403
|
+
else
|
|
404
|
+
{
|
|
405
|
+
syck_seq_add( $1->shortcut, $3 );
|
|
406
|
+
}
|
|
407
|
+
$$ = $1;
|
|
408
|
+
}
|
|
409
|
+
| in_implicit_map indent_sep complex_mapping
|
|
410
|
+
{
|
|
411
|
+
apply_seq_in_map( (SyckParser *)parser, $1 );
|
|
412
|
+
syck_map_update( $1, $3 );
|
|
413
|
+
syck_free_node( $3 );
|
|
414
|
+
$3 = NULL;
|
|
415
|
+
$$ = $1;
|
|
416
|
+
}
|
|
417
|
+
| in_implicit_map indent_sep
|
|
418
|
+
{
|
|
419
|
+
$$ = $1;
|
|
420
|
+
}
|
|
421
|
+
;
|
|
422
|
+
|
|
423
|
+
/*
|
|
424
|
+
* Inline maps
|
|
425
|
+
*/
|
|
426
|
+
basic_mapping : atom ':' atom_or_empty
|
|
427
|
+
{
|
|
428
|
+
$$ = syck_new_map(
|
|
429
|
+
syck_hdlr_add_node( (SyckParser *)parser, $1 ),
|
|
430
|
+
syck_hdlr_add_node( (SyckParser *)parser, $3 ) );
|
|
431
|
+
}
|
|
432
|
+
;
|
|
433
|
+
|
|
434
|
+
inline_map : '{' in_inline_map '}'
|
|
435
|
+
{
|
|
436
|
+
$$ = $2;
|
|
437
|
+
}
|
|
438
|
+
| '{' '}'
|
|
439
|
+
{
|
|
440
|
+
$$ = syck_alloc_map();
|
|
441
|
+
}
|
|
442
|
+
;
|
|
443
|
+
|
|
444
|
+
in_inline_map : inline_map_atom
|
|
445
|
+
| in_inline_map ',' inline_map_atom
|
|
446
|
+
{
|
|
447
|
+
syck_map_update( $1, $3 );
|
|
448
|
+
syck_free_node( $3 );
|
|
449
|
+
$3 = NULL;
|
|
450
|
+
$$ = $1;
|
|
451
|
+
}
|
|
452
|
+
;
|
|
453
|
+
|
|
454
|
+
inline_map_atom : atom
|
|
455
|
+
{
|
|
456
|
+
NULL_NODE( parser, n );
|
|
457
|
+
$$ = syck_new_map(
|
|
458
|
+
syck_hdlr_add_node( (SyckParser *)parser, $1 ),
|
|
459
|
+
syck_hdlr_add_node( (SyckParser *)parser, n ) );
|
|
460
|
+
}
|
|
461
|
+
| basic_mapping
|
|
462
|
+
;
|
|
463
|
+
|
|
464
|
+
%%
|
|
465
|
+
|
|
466
|
+
void
|
|
467
|
+
apply_seq_in_map( SyckParser *parser, SyckNode *n )
|
|
468
|
+
{
|
|
469
|
+
long map_len;
|
|
470
|
+
if ( n->shortcut == NULL )
|
|
471
|
+
{
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
map_len = syck_map_count( n );
|
|
476
|
+
syck_map_assign( n, map_value, map_len - 1,
|
|
477
|
+
syck_hdlr_add_node( parser, n->shortcut ) );
|
|
478
|
+
|
|
479
|
+
n->shortcut = NULL;
|
|
480
|
+
}
|
|
481
|
+
|