Skip to content

[doc] add tutorial pages #154

@HerringtonDarkholme

Description

@HerringtonDarkholme

Introduction:

  1. introduction to ast-grep
  2. Why you need structural search
  3. what is ast? what is parser? how computer parse your code text
  4. introduction to tree-sitter

Basic:

  1. simple pattern
  2. multi-nodes match $$$
  3. simple rule
  4. simple kind
  5. simple regex
  6. simple relational rule with stopBy: end
  7. use and / any / not
  8. use fix

Intermediate:

  1. Refine your pattern: pattern with context
  2. Refine your relational rule: stopBy & field
  3. utility rule: reusable ast-grep rule
  4. constraints: a simple way to constrain how metavar matches
  5. Use sgconfig to setup project
  6. use sg test to test your rules
  7. use ast-grep vscode and lsp
  8. use ast-grep playground to develop your rule
  9. how to develop and debug rule
  10. use ast-grep with AI

Advanced:

  1. Refine your pattern II: understand pattern syntax
  2. Refine your pattern III: understand how ast-grep matches and strictness
  3. utility rule II: recursion (use recursion to munch nodes)
  4. use fix II: expand your fix area
  5. transform: rewrite metavar
  6. transfomr II: rewriter for more advanced manipulation
  7. customize matched label
  8. ast-grep API usage
  9. use ast-grep CLI as a tool: JSON mode and stdin mode
  10. use custom language
  11. handling embedded code: languageInjection
  12. ast-grep limitation and decision tree
    no language specific stuff like macro
    no static analyssi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions