Tíquete #25180

文法の構築がもっと簡単にできるようにしたい。

: 2011-05-16 19:20 Última Atualização: 2011-05-16 19:35

Relator:
(del#42492)
Dono:
(del#42492)
Estado:
Fechado
Componente:
Marcos:
(Nenhum)
Prioridade:
5 - Medium
Gravidade:
5 - Medium
Resolução:
Fixed
Arquivo:
Nenhum

Details

Hello, World プログラム にて「ハローワールド」という文法を受理するだけの文法を作成するにも、以下のように長くなってしまう。

  1. addGrammarTransition(
  2. GrammarTransitionPtr(
  3. new GrammarTransition(
  4. GrammarPhrasePtr(new GrammarPhrase("ハローワールド")),
  5. Grammar::START_STATE_NAME,
  6. Grammar::FINISH_STATE_NAME
  7. )
  8. )
  9. );

もっと文法の構築が簡単にできるようにしたい。

Ticket History (3/4 Histories)

2011-05-16 19:20 Updated by: (del#42492)
  • New Ticket "文法の構築がもっと簡単にできるようにしたい。" created
2011-05-16 19:24 Updated by: (del#42492)
  • Estado Update from Aberto to Fechado
  • Ticket Close date is changed to 2011-05-16 19:24
Comentário

GrammarCommonImpl にメソッドを追加して、以下のように記述が可能なようにした。

  1. addGrammarTransition("ハローワールド", Grammar::START_STATE_NAME, Grammar::FINISH_STATE_NAME);

また、上記に加えてプロパティの指定を可能にするメソッドのバリエーションも追加した。

  1. class GrammarCommonImpl : public Grammar {
  2. // ...
  3. public:
  4. void addGrammarTransition(const std::string& phrase, const Grammar::State& startState, const Grammar::State& endState);
  5. void addGrammarTransition(const std::string& phrase, const std::string& propertyName, const Grammar::State& startState, const Grammar::State& endState);
  6. void addGrammarTransition(const std::string& phrase, const std::string& propertyName, int propertyInt, const Grammar::State& startState, const Grammar::State& endState);
  7. void addGrammarTransition(const std::string& phrase, const std::string& propertyName, const std::string& propertyString, const Grammar::State& startState, const Grammar::State& endState);
  8. void addGrammarTransition(const std::string& phrase, const std::string& propertyName, int propertyInt, const std::string& propertyString, const Grammar::State& startState, const Grammar::State& endState);
  9. // ...
  10. };
2011-05-16 19:35 Updated by: (del#42492)
  • Resolução Update from Nenhum to Fixed
2011-05-16 19:35 Updated by: (del#42492)
  • Componente Update from (Nenhum) to grammar

Attachment File List

No attachments

Editar

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login