Created
          February 21, 2020 18:07 
        
      - 
      
 - 
        
Save toonetown/b529408d508180dfee742322b086e962 to your computer and use it in GitHub Desktop.  
    Prints out all the c++ tokens (keying off ::) in a file
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| [ -f "${1}" ] || { echo "Usage: ${0} <file>" >&2; return 1; } | |
| cat "${1}" \ | |
| | sed -e 's|//.*$||g' \ | |
| | sed -e 's/::/xxDOUBLExCOLONxx/g' \ | |
| | perl -ne '{ print join("\n",split(/[[:^word:]]+/)),"\n"; }' \ | |
| | sed -e 's/xxDOUBLExCOLONxx/::/g' \ | |
| | grep '::' \ | |
| | grep -v '^::' \ | |
| | sort -u | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment