Module: Ibex::Frontend::TokenAdapter::DeclarationDocumentState
- Included in:
- DeclarationState
- Defined in:
- lib/ibex/frontend/token_adapter/declaration_document_state.rb,
sig/ibex/frontend/token_adapter/declaration_document_state.rbs
Overview
Root/fragment header and include-path transitions for declaration classification.
Instance Method Summary collapse
- #class_keyword(token) ⇒ external_token
- #classify_include(type) ⇒ external_token?
- #reject_fragment_pragma(token, value) ⇒ void
Instance Method Details
#class_keyword(token) ⇒ external_token
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ibex/frontend/token_adapter/declaration_document_state.rb', line 11 def class_keyword(token) # @type self: DeclarationState value = string_value(token) if value == "fragment" raise Ibex::Error, "#{token.location}: fragments require extended mode" unless @extended_mode @fragment = true @state = :declaration return :FRAGMENT end return :IDENTIFIER unless value == "class" @state = :class_name :CLASS end |
#classify_include(type) ⇒ external_token?
28 29 30 31 32 33 34 35 |
# File 'lib/ibex/frontend/token_adapter/declaration_document_state.rb', line 28 def classify_include(type) # @type self: DeclarationState return unless @state == :include_path && type == :LITERAL @state = :declaration @declaration = nil type end |
#reject_fragment_pragma(token, value) ⇒ void
This method returns an undefined value.
38 39 40 41 42 43 |
# File 'lib/ibex/frontend/token_adapter/declaration_document_state.rb', line 38 def reject_fragment_pragma(token, value) # @type self: DeclarationState return unless @fragment && value == "pragma" raise Ibex::Error, "#{token.location}: pragma declarations are not allowed in fragments" end |