Reference Documentation

  1. Overview
    1. What is Xtext?
    2. How Does It Work?
    3. Xtext is Highly Configurable
    4. Who Uses Xtext?
    5. Who is Behind Xtext?
    6. What is a Domain-Specific Language
  2. The Grammar Language
    1. A First Example
    2. The Syntax
      1. Language Declaration
      2. EPackage Declarations
        1. EPackage Generation
        2. EPackage Import
          1. Using Namespace URIs to Import Existing EPackages
          2. Using Resource URIs to Import Existing EPackages - Deprecated
          3. Using Class Path URIs to Import Existing EPackages - Deprecated
        3. Ecore Model Aliases for EPackages
      3. Rules
        1. Terminal Rules
          1. Return Types
        2. Extended Backus-Naur Form Expressions
          1. Keywords / Characters
          2. Character Ranges
          3. Wildcard
          4. Until Token
          5. Negated Token
          6. Rule Calls
          7. Alternatives
          8. Groups
        3. Terminal Fragments
        4. EOF - End Of File
      4. Parser Rules
        1. Extended Backus-Naur Form Expressions
          1. Assignments
          2. Cross-References
          3. Unordered Groups
          4. Simple Actions
          5. Unassigned Rule Calls
          6. Assigned Actions
      5. Hidden Terminal Symbols
      6. Data Type Rules
      7. Enum Rules
      8. Syntactic Predicates
    3. Ecore Model Inference
      1. Type and Package Generation
      2. Feature and Type Hierarchy Generation
      3. Enum Literal Generation
      4. Feature Normalization
      5. Error Conditions
    4. Grammar Mixins
    5. Common Terminals
  3. Configuration
    1. The Language Generator
      1. A Short Introduction to MWE2
      2. General Architecture
        1. Generator Fragments
        2. Configuration
      3. Standard Generator Fragments
    2. Dependency Injection in Xtext with Google Guice
      1. The Module API
      2. Obtaining an Injector
  4. Runtime Concepts
    1. Runtime Setup (ISetup)
    2. Setup within Eclipse-Equinox (OSGi)
    3. Logging
    4. Validation
      1. Automatic Validation
        1. Lexer/Parser: Syntactical Validation
        2. Linker: Cross-link Validation
        3. Serializer: Concrete Syntax Validation
      2. Custom Validation
      3. Validating Manually
      4. Test Validators
    5. Linking
      1. Declaration of Cross-links
      2. Default Runtime Behavior (Lazy Linking)
    6. Scoping
      1. Global Scopes and Resource Descriptions
        1. Resource and EObject Descriptions
        2. Global Scopes Based On Explicit Imports (ImportURI Mechanism)
        3. Global Scopes Based On External Configuration (e.g. Class Path Based)
          1. About the Index, Containers and Their Manager
          2. JDT-Based Container Manager
          3. Eclipse Project-Based Containers
          4. ResourceSet-Based Containers
      2. Local Scoping
        1. Declarative Scoping
      3. Imported Namespace-Aware Scoping
        1. org.eclipse.xtext.naming.IQualifiedNameProvider
        2. Importing Namespaces
    7. Value Converter
    8. Serialization
      1. The Contract
      2. Roles of the Semantic Model and the Node Model During Serialization
      3. Parse Tree Constructor
      4. Options
      5. Preserving Comments from the Node Model
      6. Transient Values
      7. Unassigned Text
      8. Cross-Reference Serializer
      9. Merge White Space
      10. Token Stream
    9. Formatting (Pretty Printing)
      1. General FormattingConfig Settings
      2. FormattingConfig Instructions
      3. Grammar Element Finders
    10. Fragment Provider (Referencing Xtext Models From Other EMF Artifacts)
    11. Encoding in Xtext
      1. Encoding at Language Design Time
      2. Encoding at Language Runtime
      3. Encoding of an XtextResource
      4. Encoding in New Model Projects
      5. Encoding of Xtext Source Code
  5. IDE Concepts
    1. Label Provider
      1. Label Providers For EObjects
        1. DefaultEObjectLabelProvider
      2. Label Providers For Index Entries
    2. Content Assist
    3. Quick Fixes
      1. Quick Fixes for Linking Errors and Syntax Errors
    4. Template Proposals
      1. Cross Reference Template Variable Resolver
      2. Enumeration Template Variable Resolver
    5. Outline View
      1. Influencing the outline structure
      2. Styling the outline
      3. Filtering actions
      4. Sorting actions
      5. Quick Outline
    6. Hyperlinking
      1. Location Provider
      2. Customizing Available Hyperlinks
    7. Syntax Coloring
      1. Lexical Highlighting
      2. Semantic Highlighting
    8. Rename Refactoring
      1. Customizing
      2. Rename Participants
  6. Xtext and Java
    1. Plug-in Setup
    2. Referring to Java Elements using JVM Types
      1. Customization Points
    3. Referring to Java Types Using Xbase
    4. Inferring a JVM Model
      1. Linking and Indexing
    5. Using Xbase Expressions
      1. Making Your Grammar Refer To Xbase
      2. Using the Xbase Interpreter
    6. Xbase Language Reference
      1. Lexical Syntax
        1. Identifiers
          1. Escaped Identifiers
          2. Syntax
          3. Examples
        2. Comments
        3. White Space
        4. Reserved Keywords
      2. Types
        1. Simple Type References
          1. Examples
        2. Parameterized Type References
          1. Examples
        3. Primitives
        4. Arrays
        5. Function Types
          1. Examples
        6. Conformance and Conversion
        7. Common Super Type
      3. Expressions
        1. Literals
          1. String Literals
          2. Examples
          3. Number Literals
          4. Boolean Literals
          5. Null Literal
          6. Type Literals
        2. Type Casts
          1. Examples
        3. Infix Operators / Operator Overloading
          1. Short-Circuit Boolean Operators
          2. Examples
          3. With Operator
        4. Assignments
        5. Feature Calls
          1. Property Access
          2. Null-Safe Feature Call
          3. Static Feature Calls
        6. Implicit variables 'this' and 'it'
        7. Constructor Call
          1. Examples
        8. Lambda Expressions
          1. Typing
          2. Function Mapping
          3. Implicit Parameter it
          4. Examples
          5. Refering the current function
        9. If Expression
          1. Typing
          2. Examples
        10. Switch Expression
          1. Type guards
          2. Typing
          3. Examples
        11. Variable Declarations
          1. Typing
        12. Blocks
          1. Examples
        13. For Loop
        14. While Loop
          1. Examples
        15. Do-While Loop
          1. Examples
        16. Return Expression
        17. Throwing Exceptions
        18. Try, Catch, Finally
      4. Extension Methods
        1. Examples
        2. Builder Syntax
  7. MWE2
    1. Examples
      1. The Simplest Workflow
      2. A Simple Transformation
      3. A Stop-Watch
    2. Language Reference
      1. Mapping to Java Classes
      2. Module
      3. Properties
      4. Mandatory Properties
      5. Named Components
      6. Auto Injection
    3. Syntax Reference
      1. Module
      2. Property
      3. Component
      4. String Literals
      5. Boolean Literals
      6. References
  8. Integration with EMF and Other EMF Editors
    1. Model, Ecore Model, and Ecore
    2. EMF Code Generation
    3. XtextResource Implementation
    4. Integration with GMF Editors
      1. Stage 1: Make GMF Read and Write the Semantic Model As Text
      2. Stage 2: Calling the Xtext Parser to Parse GMF Labels
      3. Stage 3: A Popup Xtext Editor (experimental)