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. simple kind
  3. simple regex
  4. multi-nodes match $$$
  5. use fix

Intermediate:

  1. Refine your pattern: pattern with context
  2. Use sgconfig to setup project
  3. use sg test to test your rules
  4. regex in pattern
  5. use and / any / not
  6. use relational rule 6. refine relational rule I: field7. refine relational rule II: stopBy
  7. Example: extract child field using metavar & has

Advanced:

  1. Refine your pattern II: understand how ast-grep matches
  2. utility rule
  3. utility rule II: recursion (use recursion to munch nodes)
  4. manipulate metavar using transform
  5. DasSurma trick to handle commas

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