0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
HsParser.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #ifndef HYPERTABLE_HSPARSER_H
23 #define HYPERTABLE_HSPARSER_H
24 
25 //#define BOOST_SPIRIT_DEBUG ///$$$ DEFINE THIS WHEN DEBUGGING $$$///
26 
27 #ifdef BOOST_SPIRIT_DEBUG
28 #define HS_DEBUG(str) std::cerr << str << std::endl
29 #else
30 #define HS_DEBUG(str)
31 #endif
32 
33 #include <Hyperspace/Protocol.h>
34 #include <Hyperspace/Session.h>
35 
36 #include <Common/Error.h>
37 #include <Common/FileUtils.h>
38 #include <Common/Logger.h>
39 
40 #include <boost/algorithm/string.hpp>
41 #include <boost/spirit/include/classic_confix.hpp>
42 #include <boost/spirit/include/classic_core.hpp>
43 #include <boost/spirit/include/classic_escape_char.hpp>
44 #include <boost/spirit/include/classic_grammar.hpp>
45 #include <boost/spirit/include/classic_symbols.hpp>
46 
47 #include <cstdlib>
48 #include <fstream>
49 #include <iostream>
50 #include <unordered_map>
51 #include <vector>
52 
53 namespace Hyperspace {
54 
55  namespace HsParser {
56 
57  using namespace boost;
58  using namespace boost::spirit;
59  using namespace boost::spirit::classic;
60 
61  enum {
89  };
90 
91  enum {
94  };
95 
96  class ParserState {
97  public:
98  ParserState() : open_flag(0), event_mask(0), command(0),
99  lock_mode(0), last_attr_size(0), locate_type(0), recursive(false), as_commands(false) { }
108  std::vector<Attribute> attrs;
109  std::unordered_map<String,String> attr_map;
112  int command;
116  bool recursive;
118  };
119 
120  struct set_command {
121  set_command(ParserState &state_, int cmd)
122  : state(state_), command(cmd) { }
123  void operator()(char const *, char const *) const {
124  state.command = command;
125  }
127  int command;
128  };
129 
130  struct set_file_name {
131  set_file_name(ParserState &state_) : state(state_) { }
132  void operator()(char const *str, char const *end) const {
133  state.file_name = String(str, end-str);
134  }
136  };
137 
139  set_as_commands(ParserState &state_) : state(state_) { }
140  void operator()(char const *str, char const *end) const {
141  state.as_commands = true;
142  }
144  };
145 
146  struct set_outfile {
147  set_outfile(ParserState &state_) : state(state_) { }
148  void operator()(char const *str, char const *end) const {
149  state.outfile = String(str, end-str);
150  trim_if(state.outfile, is_any_of("'\""));
151  }
153  };
154 
155  struct set_dir_name {
156  set_dir_name(ParserState &state_) : state(state_) { }
157  void operator()(char const *str, char const *end) const {
158  state.dir_name = String(str, end-str);
159  }
161  };
162 
163  struct set_node_name {
164  set_node_name(ParserState &state_) : state(state_) { }
165  void operator()(char const *str, char const *end) const {
166  state.node_name = String(str, end-str);
167  }
169  };
170 
171  struct set_any_string {
172  set_any_string(ParserState &state_) : state(state_) { }
173  void operator()(char const *str, char const *end) const {
174  state.str = String(str, end-str);
175  }
177  };
178 
179  struct set_help {
180  set_help(ParserState &state_) : state(state_) { }
181  void operator()(char const *str, char const *end) const {
182  state.command = COMMAND_HELP;
183  state.help_str = String(str, end-str);
184  trim(state.help_str);
185  to_lower(state.help_str);
186  }
188  };
189 
190  struct set_open_flag {
191  set_open_flag(ParserState &state_, int open_flag_)
192  : state(state_), open_flag(open_flag_) { }
193  void operator()(char const *str, char const *end) const {
194  state.open_flag |= open_flag;
195  }
198  };
199 
200  struct set_event_mask {
201  set_event_mask(ParserState &state_, int event_mask_)
202  : state(state_), event_mask(event_mask_) { }
203  void operator()(char const *str, char const *end) const {
204  state.event_mask |= event_mask;
205  }
208  };
209 
211  set_last_attr_name(ParserState &state_) : state(state_) { }
212  void operator()(char const *str, char const *end) const {
213  state.last_attr_name = String(str, end-str);
214  HS_DEBUG("set_last_attr_name" << state.last_attr_name);
215  }
217  };
218 
220  set_last_attr_value(ParserState &state_) : state(state_) { }
221  void operator()(char const *str, char const *end) const {
222  String escaped_double_quote("\\\"");
223  String unescaped_double_quote(1, '"');
224  String escaped_single_quote("\\\'");
225  String unescaped_single_quote("'");
226 
227  state.last_attr_value = String(str, end-str);
228  boost::trim_if(state.last_attr_value, is_any_of("'\""));
229  boost::algorithm::replace_all(state.last_attr_value, escaped_double_quote, unescaped_double_quote);
230  boost::algorithm::replace_all(state.last_attr_value, escaped_single_quote, unescaped_single_quote);
231 
232  HS_DEBUG("set_last_attr_value" << state.last_attr_value);
233  }
235  };
236 
238  set_last_attr_size(ParserState &state_) : state(state_) { }
239  void operator()(char const *str, char const *end) const {
240  String size_str = String(str, end-str);
241  }
243  };
244 
245  struct set_last_attr {
246  set_last_attr(ParserState &state_) : state(state_) { }
247  void operator()(char const *str, char const *end) const {
248  Attribute attr;
249  std::unordered_map<String,String>::iterator iter;
250 
251  state.attr_map[state.last_attr_name] = state.last_attr_value;
252  iter = state.attr_map.find(state.last_attr_name);
253  if(iter == state.attr_map.end())
255  "Error: Problem setting attribute");
256 
257  attr.name = (*iter).first.c_str();
258  attr.value = (*iter).second.c_str();
259  attr.value_len = strlen((const char*) attr.value);
260  state.attrs.push_back(attr);
261  state.last_attr_size = attr.value_len;
262  }
264  };
265 
266  struct set_lock_mode {
267  set_lock_mode(ParserState &state_, int lock_mode_)
268  : state(state_), lock_mode(lock_mode_) { }
269  void operator()(char const *str, char const *end) const {
270  state.lock_mode = lock_mode;
271  }
274  };
275 
277  set_locate_type(ParserState &state_, int locate_type_)
278  : state(state_), locate_type(locate_type_) { }
279  void operator()(char const *str, char const *end) const {
280  state.locate_type = locate_type;
281  }
284  };
285 
286  struct set_recursive {
287  set_recursive(ParserState &state) : state(state) { }
288  void operator()(char const *str, char const *end) const {
289  state.recursive = true;
290  }
292  };
293 
294  struct Parser : public grammar<Parser> {
295  Parser(ParserState &state_) : state(state_) { }
296 
297  template <typename Scanner>
298  struct definition {
299 
300  definition(Parser const &self) {
301  keywords =
302  "flags", "FLAGS", "attr", "ATTR", "event-mask", "EVENT-MASK";
303 
304  /*
305  * OPERATORS
306  */
307  chlit<> ONE('1');
308  chlit<> ZERO('0');
309  chlit<> SINGLEQUOTE('\'');
310  chlit<> DOUBLEQUOTE('"');
311  chlit<> QUESTIONMARK('?');
312  chlit<> PLUS('+');
313  chlit<> MINUS('-');
314  chlit<> STAR('*');
315  chlit<> SLASH('/');
316  chlit<> COMMA(',');
317  chlit<> SEMI(';');
318  chlit<> COLON(':');
319  chlit<> EQUAL('=');
320  strlit<> DOUBLEEQUAL("==");
321  chlit<> LT('<');
322  strlit<> LE("<=");
323  strlit<> GE(">=");
324  chlit<> GT('>');
325  strlit<> SW("=^");
326  chlit<> LPAREN('(');
327  chlit<> RPAREN(')');
328  chlit<> LBRACK('[');
329  chlit<> RBRACK(']');
330  chlit<> POINTER('^');
331  chlit<> DOT('.');
332  chlit<> BITOR('|');
333  strlit<> DOTDOT("..");
334  strlit<> DOUBLEQUESTIONMARK("??");
335 
336  /*
337  * TOKENS
338  */
339  typedef inhibit_case<strlit<> > Token;
340  Token C_MKDIR = as_lower_d["mkdir"];
341  Token C_MKDIRS = as_lower_d["mkdirs"];
342  Token C_DELETE = as_lower_d["delete"];
343  Token C_OPEN = as_lower_d["open"];
344  Token C_CREATE = as_lower_d["create"];
345  Token C_CLOSE = as_lower_d["close"];
346  Token C_ATTRSET = as_lower_d["attrset"];
347  Token C_ATTRGET = as_lower_d["attrget"];
348  Token C_ATTRINCR = as_lower_d["attrincr"];
349  Token C_ATTRDEL = as_lower_d["attrdel"];
350  Token C_ATTREXISTS = as_lower_d["attrexists"];
351  Token C_ATTRLIST = as_lower_d["attrlist"];
352  Token C_EXISTS = as_lower_d["exists"];
353  Token C_READDIR = as_lower_d["readdir"];
354  Token C_READDIRATTR = as_lower_d["readdirattr"];
355  Token C_READPATHATTR = as_lower_d["readpathattr"];
356  Token C_DUMP = as_lower_d["dump"];
357  Token C_LOCK = as_lower_d["lock"];
358  Token C_TRYLOCK = as_lower_d["trylock"];
359  Token C_RELEASE = as_lower_d["release"];
360  Token C_GETSEQ = as_lower_d["getseq"];
361  Token C_ECHO = as_lower_d["echo"];
362  Token C_HELP = as_lower_d["help"];
363  Token C_LOCATE = as_lower_d["locate"];
364  Token C_STATUS = as_lower_d["status"];
365 
366  Token ESC_HELP = as_lower_d["\\h"];
367 
368  Token AS_COMMANDS = as_lower_d["as_commands"];
369  Token FLAGS = as_lower_d["flags"];
370  Token EVENTMASK = as_lower_d["event-mask"];
371  Token O_READ = as_lower_d["read"];
372  Token O_WRITE = as_lower_d["write"];
373  Token O_LOCK = as_lower_d["lock"];
374  Token O_CREATE = as_lower_d["create"];
375  Token O_EXCLUSIVE = as_lower_d["excl"];
376  Token O_TEMP = as_lower_d["temp"];
377  Token O_LOCK_SHARED = as_lower_d["lock_shared"];
378  Token O_LOCK_EXCLUSIVE = as_lower_d["lock_exclusive"];
379  Token M_ATTR_SET = as_lower_d["attr_set"];
380  Token M_ATTR_DEL = as_lower_d["attr_del"];
381  Token M_CHILD_NODE_ADDED = as_lower_d["child_node_added"];
382  Token M_CHILD_NODE_REMOVED = as_lower_d["child_node_removed"];
383  Token M_LOCK_ACQUIRED = as_lower_d["lock_acquired"];
384  Token M_LOCK_RELEASED = as_lower_d["lock_released"];
385  Token ATTR = as_lower_d["attr"];
386  Token L_SHARED = as_lower_d["shared"];
387  Token L_EXCLUSIVE = as_lower_d["exclusive"];
388  Token R_MASTER = as_lower_d["master"];
389  Token R_REPLICAS = as_lower_d["replicas"];
390  Token FLAG_R = as_lower_d["-r"];
391 
392  /*
393  * Start grammar definition
394  */
395 
396  node_name
397  = lexeme_d[(+(anychar_p - space_p)) - (keywords)];
398 
399  identifier
400  = lexeme_d[(alpha_p >> *(alnum_p | '_')) - (keywords)];
401 
402  string_literal
403  = single_string_literal
404  | double_string_literal
405  ;
406 
407  any_string
408  = lexeme_d[*(anychar_p)]
409  ;
410 
411  single_string_literal
412  = confix_p(SINGLEQUOTE, *lex_escape_ch_p, SINGLEQUOTE);
413 
414  double_string_literal
415  = confix_p(DOUBLEQUOTE, *lex_escape_ch_p, DOUBLEQUOTE);
416 
417  user_identifier
418  = identifier
419  | string_literal
420  ;
421 
422  statement
423  = mkdirs_statement[set_command(self.state, COMMAND_MKDIRS)]
424  | mkdir_statement[set_command(self.state, COMMAND_MKDIR)]
425  | delete_statement[set_command(self.state, COMMAND_DELETE)]
426  | open_statement[set_command(self.state, COMMAND_OPEN)]
427  | create_statement[set_command(self.state, COMMAND_CREATE)]
428  | close_statement[set_command(self.state, COMMAND_CLOSE)]
429  | help_statement[set_command(self.state,COMMAND_HELP)]
430  | attrset_statement[set_command(self.state, COMMAND_ATTRSET)]
431  | attrget_statement[set_command(self.state, COMMAND_ATTRGET)]
432  | attrincr_statement[set_command(self.state, COMMAND_ATTRINCR)]
433  | attrdel_statement[set_command(self.state, COMMAND_ATTRDEL)]
434  | attrexists_statement[set_command(self.state, COMMAND_ATTREXISTS)]
435  | attrlist_statement[set_command(self.state, COMMAND_ATTRLIST)]
436  | exists_statement[set_command(self.state,COMMAND_EXISTS)]
437  | readdir_statement[set_command(self.state, COMMAND_READDIR)]
438  | readdirattr_statement[set_command(self.state, COMMAND_READDIRATTR)]
439  | readpathattr_statement[set_command(self.state, COMMAND_READPATHATTR)]
440  | dump_statement[set_command(self.state, COMMAND_DUMP)]
441  | lock_statement[set_command(self.state, COMMAND_LOCK)]
442  | trylock_statement[set_command(self.state, COMMAND_TRYLOCK)]
443  | release_statement[set_command(self.state, COMMAND_RELEASE)]
444  | getseq_statement[set_command(self.state, COMMAND_GETSEQ)]
445  | echo_statement[set_command(self.state, COMMAND_ECHO)]
446  | locate_statement[set_command(self.state, COMMAND_LOCATE)]
447  | status_statement[set_command(self.state, COMMAND_STATUS)]
448  ;
449 
450  mkdir_statement
451  = C_MKDIR >> node_name[set_dir_name(self.state)]
452  ;
453 
454  mkdirs_statement
455  = C_MKDIRS >> node_name[set_dir_name(self.state)]
456  ;
457 
458  delete_statement
459  = C_DELETE >> node_name[set_node_name(self.state)]
460  ;
461 
462  open_statement
463  = C_OPEN >> node_name[set_node_name(self.state)]
464  >> !(FLAGS >> EQUAL >> open_flag_value)
465  >> !(EVENTMASK >> EQUAL >> open_event_mask_value)
466  ;
467 
468  create_statement
469  = C_CREATE >> node_name[set_file_name(self.state)]
470  >> FLAGS >> EQUAL >> create_flag_value
471  >> *(one_create_option)
472  ;
473 
474  close_statement
475  = C_CLOSE >> node_name[set_node_name(self.state)];
476 
477  attrset_statement
478  = C_ATTRSET >> node_name[set_node_name(self.state)] >> attribute;
479 
480  attrget_statement
481  = C_ATTRGET >> node_name[set_node_name(self.state)]
482  >> user_identifier[set_last_attr_name(self.state)]
483  ;
484 
485  attrincr_statement
486  = C_ATTRINCR >> node_name[set_node_name(self.state)]
487  >> user_identifier[set_last_attr_name(self.state)]
488  ;
489 
490  attrdel_statement
491  = C_ATTRDEL >> node_name[set_node_name(self.state)]
492  >> user_identifier[set_last_attr_name(self.state)]
493  ;
494 
495  attrexists_statement
496  = C_ATTREXISTS >> node_name[set_node_name(self.state)]
497  >> user_identifier[set_last_attr_name(self.state)]
498  ;
499 
500  attrlist_statement
501  = C_ATTRLIST >> node_name[set_node_name(self.state)]
502  ;
503 
504  exists_statement
505  = C_EXISTS >> node_name[set_node_name(self.state)]
506  ;
507 
508  readdir_statement
509  = C_READDIR >> node_name[set_dir_name(self.state)];
510 
511  readdirattr_statement
512  = C_READDIRATTR >> !(FLAG_R[set_recursive(self.state)])
513  >> node_name[set_dir_name(self.state)]
514  >> user_identifier[set_last_attr_name(self.state)]
515  ;
516 
517  readpathattr_statement
518  = C_READPATHATTR >> node_name[set_dir_name(self.state)]
519  >> user_identifier[set_last_attr_name(self.state)]
520  ;
521 
522  dump_statement
523  = C_DUMP >> node_name[set_dir_name(self.state)]
524  >> !(AS_COMMANDS[set_as_commands(self.state)])
525  >> !(string_literal[set_outfile(self.state)])
526  ;
527 
528 
529  lock_statement
530  = C_LOCK >> node_name[set_node_name(self.state)] >> lock_mode;
531 
532  trylock_statement
533  = C_TRYLOCK >> node_name[set_node_name(self.state)] >> lock_mode;
534 
535  release_statement
536  = C_RELEASE >> node_name[set_node_name(self.state)];
537 
538  getseq_statement
539  = C_GETSEQ >> node_name[set_node_name(self.state)];
540 
541  echo_statement
542  = C_ECHO >> any_string[set_any_string(self.state)];
543  ;
544 
545  help_statement
546  = (C_HELP | ESC_HELP | QUESTIONMARK )
547  >> any_string[set_help(self.state)];
548  ;
549 
550  locate_statement
551  = C_LOCATE >> locate_type
552  ;
553 
554  status_statement
555  = C_STATUS
556  ;
557 
558  one_open_flag_value
559  = O_READ[set_open_flag(self.state, OPEN_FLAG_READ)]
560  | O_WRITE[set_open_flag(self.state, OPEN_FLAG_WRITE)]
561  | O_CREATE[set_open_flag(self.state, OPEN_FLAG_CREATE)]
562  | O_EXCLUSIVE[set_open_flag(self.state, OPEN_FLAG_EXCL)]
563  | O_TEMP[set_open_flag(self.state, OPEN_FLAG_TEMP)]
564  | O_LOCK_SHARED[set_open_flag(self.state, OPEN_FLAG_LOCK_SHARED)]
565  | O_LOCK_EXCLUSIVE[set_open_flag(self.state,
567  | O_LOCK[set_open_flag(self.state, OPEN_FLAG_LOCK)]
568  ;
569  open_flag_value
570  = one_open_flag_value >> *(BITOR >> one_open_flag_value);
571 
572  one_open_event_mask_value
573  = M_ATTR_SET[set_event_mask(self.state, EVENT_MASK_ATTR_SET)]
574  | M_ATTR_DEL[set_event_mask(self.state, EVENT_MASK_ATTR_DEL)]
575  | M_CHILD_NODE_ADDED[set_event_mask(self.state,
577  | M_CHILD_NODE_REMOVED[set_event_mask(self.state,
579  | M_LOCK_ACQUIRED[set_event_mask(self.state,
581  | M_LOCK_RELEASED[set_event_mask(self.state,
583  ;
584  open_event_mask_value
585  = one_open_event_mask_value
586  >> *(BITOR >> one_open_event_mask_value);
587 
588  one_create_flag_value
589  = O_READ[set_open_flag(self.state, OPEN_FLAG_READ)]
590  | O_WRITE[set_open_flag(self.state, OPEN_FLAG_WRITE)]
591  | O_LOCK[set_open_flag(self.state, OPEN_FLAG_LOCK)]
592  | O_EXCLUSIVE[set_open_flag(self.state, OPEN_FLAG_EXCL)]
593  | O_TEMP[set_open_flag(self.state, OPEN_FLAG_TEMP)]
594  | O_LOCK_SHARED[set_open_flag(self.state, OPEN_FLAG_LOCK_SHARED)]
595  | O_LOCK_EXCLUSIVE[set_open_flag(self.state,
597  ;
598  create_flag_value
599  = one_create_flag_value >> *(BITOR >> one_create_flag_value);
600 
601  one_create_event_mask_value
602  = M_ATTR_SET[set_event_mask(self.state, EVENT_MASK_ATTR_SET)]
603  | M_ATTR_DEL[set_event_mask(self.state, EVENT_MASK_ATTR_DEL)]
604  | M_LOCK_ACQUIRED[set_event_mask(self.state,
606  | M_LOCK_RELEASED[set_event_mask(self.state,
608  ;
609  create_event_mask_value
610  = one_create_event_mask_value
611  >> *(BITOR >> one_create_event_mask_value);
612 
613  one_create_option
614  = (
615  (ATTR >> COLON >> attribute)
616  | (
617  EVENTMASK >> EQUAL >> create_event_mask_value
618  ));
619 
620  attribute
621  = (user_identifier[set_last_attr_name(self.state)]
622  >> EQUAL >> user_identifier[set_last_attr_value(self.state)]
623  )[set_last_attr(self.state)]
624  ;
625 
626  lock_mode
627  = L_SHARED[set_lock_mode(self.state, LOCK_MODE_SHARED)]
628  | L_EXCLUSIVE[set_lock_mode(self.state, LOCK_MODE_EXCLUSIVE)]
629  ;
630 
631  locate_type
632  = R_MASTER[set_locate_type(self.state, LOCATE_MASTER)]
633  | R_REPLICAS[set_locate_type(self.state, LOCATE_REPLICAS)]
634  ;
635 
636  /*
637  * End grammar definition
638  */
639 
640 #ifdef BOOST_SPIRIT_DEBUG
641  BOOST_SPIRIT_DEBUG_RULE(identifier);
642  BOOST_SPIRIT_DEBUG_RULE(string_literal);
643  BOOST_SPIRIT_DEBUG_RULE(any_string);
644  BOOST_SPIRIT_DEBUG_RULE(single_string_literal);
645  BOOST_SPIRIT_DEBUG_RULE(double_string_literal);
646  BOOST_SPIRIT_DEBUG_RULE(user_identifier);
647  BOOST_SPIRIT_DEBUG_RULE(statement);
648  BOOST_SPIRIT_DEBUG_RULE(mkdir_statement);
649  BOOST_SPIRIT_DEBUG_RULE(mkdirs_statement);
650  BOOST_SPIRIT_DEBUG_RULE(delete_statement);
651  BOOST_SPIRIT_DEBUG_RULE(open_statement);
652  BOOST_SPIRIT_DEBUG_RULE(create_statement);
653  BOOST_SPIRIT_DEBUG_RULE(close_statement);
654  BOOST_SPIRIT_DEBUG_RULE(help_statement);
655  BOOST_SPIRIT_DEBUG_RULE(locate_statement);
656  BOOST_SPIRIT_DEBUG_RULE(status_statement);
657  BOOST_SPIRIT_DEBUG_RULE(attrset_statement);
658  BOOST_SPIRIT_DEBUG_RULE(attrget_statement);
659  BOOST_SPIRIT_DEBUG_RULE(attrincr_statement);
660  BOOST_SPIRIT_DEBUG_RULE(attrexists_statement);
661  BOOST_SPIRIT_DEBUG_RULE(attrlist_statement);
662  BOOST_SPIRIT_DEBUG_RULE(attrdel_statement);
663  BOOST_SPIRIT_DEBUG_RULE(exists_statement);
664  BOOST_SPIRIT_DEBUG_RULE(readdir_statement);
665  BOOST_SPIRIT_DEBUG_RULE(readdirattr_statement);
666  BOOST_SPIRIT_DEBUG_RULE(readpathattr_statement);
667  BOOST_SPIRIT_DEBUG_RULE(dump_statement);
668  BOOST_SPIRIT_DEBUG_RULE(lock_statement);
669  BOOST_SPIRIT_DEBUG_RULE(trylock_statement);
670  BOOST_SPIRIT_DEBUG_RULE(release_statement);
671  BOOST_SPIRIT_DEBUG_RULE(getseq_statement);
672  BOOST_SPIRIT_DEBUG_RULE(echo_statement);
673  BOOST_SPIRIT_DEBUG_RULE(one_open_flag_value);
674  BOOST_SPIRIT_DEBUG_RULE(open_flag_value);
675  BOOST_SPIRIT_DEBUG_RULE(one_open_event_mask_value);
676  BOOST_SPIRIT_DEBUG_RULE(open_event_mask_value);
677  BOOST_SPIRIT_DEBUG_RULE(one_create_flag_value);
678  BOOST_SPIRIT_DEBUG_RULE(create_flag_value);
679  BOOST_SPIRIT_DEBUG_RULE(one_create_event_mask_value);
680  BOOST_SPIRIT_DEBUG_RULE(create_event_mask_value);
681  BOOST_SPIRIT_DEBUG_RULE(one_create_option);
682  BOOST_SPIRIT_DEBUG_RULE(attribute);
683  BOOST_SPIRIT_DEBUG_RULE(lock_mode);
684  BOOST_SPIRIT_DEBUG_RULE(node_name);
685  BOOST_SPIRIT_DEBUG_RULE(locate_type);
686 #endif
687  }
688 
689  rule<Scanner> const&
690  start() const { return statement; }
691 
692  symbols<> keywords;
693 
694  rule<Scanner> identifier, string_literal, any_string,
695  single_string_literal, double_string_literal, user_identifier,
696  statement, mkdir_statement, mkdirs_statement, delete_statement, open_statement,
697  create_statement, close_statement, help_statement, locate_statement,
698  attrset_statement, attrget_statement, attrincr_statement,
699  attrexists_statement, attrdel_statement,
700  attrlist_statement, exists_statement, readdir_statement,
701  readdirattr_statement, readpathattr_statement, dump_statement, lock_statement,
702  trylock_statement, release_statement, getseq_statement, echo_statement,
703  one_open_flag_value, open_flag_value, one_open_event_mask_value,
704  open_event_mask_value, one_create_flag_value, create_flag_value,
705  one_create_event_mask_value, create_event_mask_value,
706  one_create_option, attribute, lock_mode, node_name, locate_type,
707  status_statement;
708  };
709 
711  };
712  }
713 }
714 
715 #endif // HYPERTABLE_HSPARSER_H
void operator()(char const *str, char const *end) const
Definition: HsParser.h:132
set_last_attr_name(ParserState &state_)
Definition: HsParser.h:211
set_as_commands(ParserState &state_)
Definition: HsParser.h:139
void operator()(char const *str, char const *end) const
Definition: HsParser.h:140
Boost library.
Definition: Properties.cc:39
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
set_file_name(ParserState &state_)
Definition: HsParser.h:131
Parser(ParserState &state_)
Definition: HsParser.h:295
Declarations for Protocol.
Error if create and file exists.
Definition: Session.h:79
std::vector< Attribute > attrs
Definition: HsParser.h:108
void operator()(char const *str, char const *end) const
Definition: HsParser.h:212
Po::typed_value< String > * str(String *v=0)
Definition: Properties.h:166
Lock in shared mode.
Definition: LockSequencer.h:49
void operator()(char const *, char const *) const
Definition: HsParser.h:123
Atomically open and lock file shared, fail if can't.
Definition: Session.h:83
Hyperspace definitions
set_event_mask(ParserState &state_, int event_mask_)
Definition: HsParser.h:201
set_command(ParserState &state_, int cmd)
Definition: HsParser.h:121
void operator()(char const *str, char const *end) const
Definition: HsParser.h:269
Open file for locking.
Definition: Session.h:75
void operator()(char const *str, char const *end) const
Definition: HsParser.h:165
File system utility functions.
Open file for writing.
Definition: Session.h:73
set_node_name(ParserState &state_)
Definition: HsParser.h:164
const char * name
Name of extended attribute.
Definition: Protocol.h:59
Logging routines and macros.
std::unordered_map< String, String > attr_map
Definition: HsParser.h:109
void operator()(char const *str, char const *end) const
Definition: HsParser.h:239
void operator()(char const *str, char const *end) const
Definition: HsParser.h:193
void operator()(char const *str, char const *end) const
Definition: HsParser.h:148
void operator()(char const *str, char const *end) const
Definition: HsParser.h:288
set_last_attr_size(ParserState &state_)
Definition: HsParser.h:238
set_outfile(ParserState &state_)
Definition: HsParser.h:147
set_any_string(ParserState &state_)
Definition: HsParser.h:172
Lock exclusive mode.
Definition: LockSequencer.h:51
set_lock_mode(ParserState &state_, int lock_mode_)
Definition: HsParser.h:267
set_open_flag(ParserState &state_, int open_flag_)
Definition: HsParser.h:191
set_last_attr(ParserState &state_)
Definition: HsParser.h:246
set_recursive(ParserState &state)
Definition: HsParser.h:287
#define HS_DEBUG(str)
Definition: HsParser.h:30
atomically open and lock file exclusive, fail if can't
Definition: Session.h:85
const void * value
Pointer to attribute value.
Definition: Protocol.h:62
void operator()(char const *str, char const *end) const
Definition: HsParser.h:173
Used in conjunction with CREATE to create an ephemeral file.
Definition: Session.h:81
Holds extended attribute and value.
Definition: Protocol.h:48
rule< Scanner > const & start() const
Definition: HsParser.h:690
void operator()(char const *str, char const *end) const
Definition: HsParser.h:221
void operator()(char const *str, char const *end) const
Definition: HsParser.h:157
set_locate_type(ParserState &state_, int locate_type_)
Definition: HsParser.h:277
Create file if it does not exist.
Definition: Session.h:77
set_help(ParserState &state_)
Definition: HsParser.h:180
void operator()(char const *str, char const *end) const
Definition: HsParser.h:279
void operator()(char const *str, char const *end) const
Definition: HsParser.h:203
Open file for reading.
Definition: Session.h:71
Error codes, Exception handling, error logging.
#define HT_THROW(_code_, _msg_)
Definition: Error.h:478
uint32_t value_len
Length of attribute value.
Definition: Protocol.h:65
set_dir_name(ParserState &state_)
Definition: HsParser.h:156
set_last_attr_value(ParserState &state_)
Definition: HsParser.h:220
void operator()(char const *str, char const *end) const
Definition: HsParser.h:181
void operator()(char const *str, char const *end) const
Definition: HsParser.h:247