Skip to content

Instantly share code, notes, and snippets.

@aaronpuchert
Last active April 10, 2021 21:07
Show Gist options
  • Save aaronpuchert/5f8c08347f6fb1cb4020e9561b5ccbc5 to your computer and use it in GitHub Desktop.
Save aaronpuchert/5f8c08347f6fb1cb4020e9561b5ccbc5 to your computer and use it in GitHub Desktop.

Revisions

  1. aaronpuchert revised this gist Apr 10, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion clean-ast
    Original file line number Diff line number Diff line change
    @@ -11,4 +11,4 @@ s/ <\o033\[0;33m[^\o033]*\o033\[0m, \o033\[0;33m[^\o033]*\o033\[0m>//g
    s/ \o033\[0;33m[^\o033]*\o033\[0m//g
    # Write types italic instead of in '', use → instead of : for canonicalization.
    s/\o033\[0;32m'\([^']*\)'\o033\[0m/\o033[0;3;32m\1\o033[0m/g
    s/\o033\[0;32m'\([^']*\)':'\([^']*\)'\o033\[0m/\o033[0;3;32m\1\o033[23m → \o033[3m\2\o033[0m/g
    s/\o033\[0;32m'\([^']*\)':'\([^']*\)'\o033\[0m/\o033[0;3;32m\1\o033[23m → \o033[3m\2\o033[0m/g
  2. aaronpuchert revised this gist Apr 10, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions clean-ast
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,6 @@ s/\o033\[0m\o033\[0;34m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o
    s/ <\o033\[0;33m[^\o033]*\o033\[0m>//g
    s/ <\o033\[0;33m[^\o033]*\o033\[0m, \o033\[0;33m[^\o033]*\o033\[0m>//g
    s/ \o033\[0;33m[^\o033]*\o033\[0m//g
    # Write types italic instead of in ''.
    # Write types italic instead of in '', use → instead of : for canonicalization.
    s/\o033\[0;32m'\([^']*\)'\o033\[0m/\o033[0;3;32m\1\o033[0m/g
    s/\o033\[0;32m'\([^']*\)':'\([^']*\)'\o033\[0m/\o033[0;3;32m\1\o033[0m:\o033[3;32m\2\o033[0m/g
    s/\o033\[0;32m'\([^']*\)':'\([^']*\)'\o033\[0m/\o033[0;3;32m\1\o033[23m → \o033[3m\2\o033[0m/g
  3. aaronpuchert revised this gist Mar 17, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions clean-ast
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/usr/bin/sed -f
    # The first few lines are not so interesting.
    # Remove hard-coded typedefs in the beginning.
    2,+13d
    # Remove addresses from Stmts.
    # Remove addresses from Stmts, Attrs, Comments.
    s/\o033\[0m\o033\[0;1;35m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;35m\1\o033[0m\o033[0;33m/g
    s/\o033\[0m\o033\[0;1;34m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;34m\1\o033[0m\o033[0;33m/g
    s/\o033\[0m\o033\[0;34m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;34m\1\o033[0m\o033[0;33m/g
  4. aaronpuchert revised this gist Mar 17, 2021. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions clean-ast
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,14 @@
    #!/usr/bin/sed -f
    # Remove hard-coded typedefs in the beginning.
    # The first few lines are not so interesting.
    2,+13d
    # Remove addresses from Stmts, Attrs, Comments.
    # Remove addresses from Stmts.
    s/\o033\[0m\o033\[0;1;35m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;35m\1\o033[0m\o033[0;33m/g
    s/\o033\[0m\o033\[0;1;34m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;34m\1\o033[0m\o033[0;33m/g
    s/\o033\[0m\o033\[0;34m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;34m\1\o033[0m\o033[0;33m/g
    # Remove source locations and ranges.
    s/ <\o033\[0;33m[^\o033]*\o033\[0m>//g
    s/ <\o033\[0;33m[^\o033]*\o033\[0m, \o033\[0;33m[^\o033]*\o033\[0m>//g
    s/ \o033\[0;33m[^\o033]*\o033\[0m//g
    # Write types italic instead of in ''.
    s/\o033\[0;32m'\([^']*\)'\o033\[0m/\o033[0;3;32m\1\o033[0m/g
    s/\o033\[0;32m'\([^']*\)':'\([^']*\)'\o033\[0m/\o033[0;3;32m\1\o033[0m:\o033[3;32m\2\o033[0m/g
  5. aaronpuchert revised this gist Aug 8, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions clean-ast
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    #!/usr/bin/sed -f
    # Remove hard-coded typedefs in the beginning.
    2,+13d
    # Remove addresses from Stmts, Attrs, Comments.
    s/\o033\[0m\o033\[0;1;35m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;35m\1\o033[0m\o033[0;33m/g
    s/\o033\[0m\o033\[0;1;34m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;34m\1\o033[0m\o033[0;33m/g
  6. aaronpuchert revised this gist Aug 5, 2020. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion clean-ast
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    #!/usr/bin/sed -f
    # Remove addresses from Stmts.
    # Remove addresses from Stmts, Attrs, Comments.
    s/\o033\[0m\o033\[0;1;35m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;35m\1\o033[0m\o033[0;33m/g
    s/\o033\[0m\o033\[0;1;34m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;34m\1\o033[0m\o033[0;33m/g
    s/\o033\[0m\o033\[0;34m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;34m\1\o033[0m\o033[0;33m/g
    # Remove source locations and ranges.
    s/ <\o033\[0;33m[^\o033]*\o033\[0m>//g
    s/ <\o033\[0;33m[^\o033]*\o033\[0m, \o033\[0;33m[^\o033]*\o033\[0m>//g
  7. aaronpuchert revised this gist Aug 5, 2020. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions clean-ast
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/usr/bin/sed -f
    # Remove IDs from Stmts.
    # Remove addresses from Stmts.
    s/\o033\[0m\o033\[0;1;35m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;35m\1\o033[0m\o033[0;33m/g
    # Remove source locations and ranges.
    s/ <\o033\[0;33m[^>]*\o033\[0m>//g
    s/ \o033\[0;33mline:[0-9]*:[0-9]*//g
    s/ \o033\[0;33mcol:[0-9]*//g
    s/ <\o033\[0;33m[^\o033]*\o033\[0m>//g
    s/ <\o033\[0;33m[^\o033]*\o033\[0m, \o033\[0;33m[^\o033]*\o033\[0m>//g
    s/ \o033\[0;33m[^\o033]*\o033\[0m//g
  8. aaronpuchert created this gist Aug 4, 2020.
    7 changes: 7 additions & 0 deletions clean-ast
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    #!/usr/bin/sed -f
    # Remove IDs from Stmts.
    s/\o033\[0m\o033\[0;1;35m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;35m\1\o033[0m\o033[0;33m/g
    # Remove source locations and ranges.
    s/ <\o033\[0;33m[^>]*\o033\[0m>//g
    s/ \o033\[0;33mline:[0-9]*:[0-9]*//g
    s/ \o033\[0;33mcol:[0-9]*//g