[BACK]Return to shtokenizer.go CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / pkgtools / pkglint / files

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /pkgsrc/pkgtools/pkglint/files/Attic/shtokenizer.go between version 1.11 and 1.12

version 1.11, 2018/10/03 22:27:53 version 1.12, 2018/11/07 20:58:23
Line 82  func (p *ShTokenizer) shAtomPlain() *ShA
Line 82  func (p *ShTokenizer) shAtomPlain() *ShA
                 return &ShAtom{shtWord, repl.Str(), shqSquot, nil}                  return &ShAtom{shtWord, repl.Str(), shqSquot, nil}
         case repl.AdvanceStr("`"):          case repl.AdvanceStr("`"):
                 return &ShAtom{shtWord, repl.Str(), shqBackt, nil}                  return &ShAtom{shtWord, repl.Str(), shqBackt, nil}
         case repl.AdvanceRegexp(`^#.*`):          case repl.PeekByte() == '#':
                 return &ShAtom{shtComment, repl.Group(0), q, nil}                  return &ShAtom{shtComment, repl.AdvanceRest(), q, nil}
         case repl.AdvanceStr("$$("):          case repl.AdvanceStr("$$("):
                 return &ShAtom{shtSubshell, repl.Str(), shqSubsh, nil}                  return &ShAtom{shtSubshell, repl.Str(), shqSubsh, nil}
         }          }
Line 132  func (p *ShTokenizer) shAtomBackt() *ShA
Line 132  func (p *ShTokenizer) shAtomBackt() *ShA
         return p.shAtomInternal(q, false, false)          return p.shAtomInternal(q, false, false)
 }  }
   
 // In pkgsrc, the $(...) subshell syntax is not used to preserve  // In pkgsrc, the $(...) subshell syntax is not used, in order to preserve
 // compatibility with /bin/sh from Solaris 7.  // compatibility with /bin/sh from Solaris 7.
 func (p *ShTokenizer) shAtomSubsh() *ShAtom {  func (p *ShTokenizer) shAtomSubsh() *ShAtom {
         const q = shqSubsh          const q = shqSubsh
Line 147  func (p *ShTokenizer) shAtomSubsh() *ShA
Line 147  func (p *ShTokenizer) shAtomSubsh() *ShA
         case repl.AdvanceStr("`"):          case repl.AdvanceStr("`"):
                 // FIXME: return &ShAtom{shtWord, repl.Str(), shqBackt, nil}                  // FIXME: return &ShAtom{shtWord, repl.Str(), shqBackt, nil}
         case repl.AdvanceRegexp(`^#[^)]*`):          case repl.AdvanceRegexp(`^#[^)]*`):
                 return &ShAtom{shtComment, repl.Group(0), q, nil}                  return &ShAtom{shtComment, repl.Str(), q, nil}
         case repl.AdvanceStr(")"):          case repl.AdvanceStr(")"):
                 return &ShAtom{shtWord, repl.Str(), shqPlain, nil}                  return &ShAtom{shtWord, repl.Str(), shqPlain, nil}
         case repl.AdvanceRegexp(`^(?:[!#%*+,\-./0-9:=?@A-Z\[\]^_a-z{}~]+|\\[^$]|` + reShDollar + `)+`):          case repl.AdvanceRegexp(`^(?:[!#%*+,\-./0-9:=?@A-Z\[\]^_a-z{}~]+|\\[^$]|` + reShDollar + `)+`):
                 return &ShAtom{shtWord, repl.Group(0), q, nil}                  return &ShAtom{shtWord, repl.Str(), q, nil}
         }          }
         return p.shOperator(q)          return p.shOperator(q)
 }  }
Line 185  func (p *ShTokenizer) shAtomBacktDquot()
Line 185  func (p *ShTokenizer) shAtomBacktDquot()
         case repl.AdvanceStr("\""):          case repl.AdvanceStr("\""):
                 return &ShAtom{shtWord, repl.Str(), shqBackt, nil}                  return &ShAtom{shtWord, repl.Str(), shqBackt, nil}
         case repl.AdvanceRegexp(`^(?:[\t !%&()*+,\-./0-9:;<=>?@A-Z\[\]^_a-z{|}~]+|\\[^$]|` + reShDollar + `)+`):          case repl.AdvanceRegexp(`^(?:[\t !%&()*+,\-./0-9:;<=>?@A-Z\[\]^_a-z{|}~]+|\\[^$]|` + reShDollar + `)+`):
                 return &ShAtom{shtWord, repl.Group(0), shqBacktDquot, nil}                  return &ShAtom{shtWord, repl.Str(), shqBacktDquot, nil}
         }          }
         return nil          return nil
 }  }
Line 197  func (p *ShTokenizer) shAtomBacktSquot()
Line 197  func (p *ShTokenizer) shAtomBacktSquot()
         case repl.AdvanceStr("'"):          case repl.AdvanceStr("'"):
                 return &ShAtom{shtWord, repl.Str(), shqBackt, nil}                  return &ShAtom{shtWord, repl.Str(), shqBackt, nil}
         case repl.AdvanceRegexp(`^([\t !"#%&()*+,\-./0-9:;<=>?@A-Z\[\\\]^_` + "`" + `a-z{|}~]+|\$\$)+`):          case repl.AdvanceRegexp(`^([\t !"#%&()*+,\-./0-9:;<=>?@A-Z\[\\\]^_` + "`" + `a-z{|}~]+|\$\$)+`):
                 return &ShAtom{shtWord, repl.Group(0), q, nil}                  return &ShAtom{shtWord, repl.Str(), q, nil}
         }          }
         return nil          return nil
 }  }
Line 208  func (p *ShTokenizer) shAtomSubshDquot()
Line 208  func (p *ShTokenizer) shAtomSubshDquot()
         case repl.AdvanceStr("\""):          case repl.AdvanceStr("\""):
                 return &ShAtom{shtWord, repl.Str(), shqSubsh, nil}                  return &ShAtom{shtWord, repl.Str(), shqSubsh, nil}
         case repl.AdvanceRegexp(`^(?:[\t !%&()*+,\-./0-9:;<=>?@A-Z\[\]^_a-z{|}~]+|\\[^$]|` + reShDollar + `)+`):          case repl.AdvanceRegexp(`^(?:[\t !%&()*+,\-./0-9:;<=>?@A-Z\[\]^_a-z{|}~]+|\\[^$]|` + reShDollar + `)+`):
                 return &ShAtom{shtWord, repl.Group(0), shqSubshDquot, nil}                  return &ShAtom{shtWord, repl.Str(), shqSubshDquot, nil}
         }          }
         return nil          return nil
 }  }
Line 220  func (p *ShTokenizer) shAtomSubshSquot()
Line 220  func (p *ShTokenizer) shAtomSubshSquot()
         case repl.AdvanceStr("'"):          case repl.AdvanceStr("'"):
                 return &ShAtom{shtWord, repl.Str(), shqSubsh, nil}                  return &ShAtom{shtWord, repl.Str(), shqSubsh, nil}
         case repl.AdvanceRegexp(`^([\t !"#%&()*+,\-./0-9:;<=>?@A-Z\[\\\]^_` + "`" + `a-z{|}~]+|\$\$)+`):          case repl.AdvanceRegexp(`^([\t !"#%&()*+,\-./0-9:;<=>?@A-Z\[\\\]^_` + "`" + `a-z{|}~]+|\$\$)+`):
                 return &ShAtom{shtWord, repl.Group(0), q, nil}                  return &ShAtom{shtWord, repl.Str(), q, nil}
         }          }
         return nil          return nil
 }  }
Line 232  func (p *ShTokenizer) shAtomDquotBacktDq
Line 232  func (p *ShTokenizer) shAtomDquotBacktDq
         case repl.AdvanceStr("\""):          case repl.AdvanceStr("\""):
                 return &ShAtom{shtWord, repl.Str(), shqDquotBackt, nil}                  return &ShAtom{shtWord, repl.Str(), shqDquotBackt, nil}
         case repl.AdvanceRegexp(`^(?:[\t !%&()*+,\-./0-9:;<=>?@A-Z\[\]^_a-z{|}~]+|\\[^$]|` + reShDollar + `)+`):          case repl.AdvanceRegexp(`^(?:[\t !%&()*+,\-./0-9:;<=>?@A-Z\[\]^_a-z{|}~]+|\\[^$]|` + reShDollar + `)+`):
                 return &ShAtom{shtWord, repl.Group(0), q, nil}                  return &ShAtom{shtWord, repl.Str(), q, nil}
         }          }
         return nil          return nil
 }  }
Line 243  func (p *ShTokenizer) shAtomDquotBacktSq
Line 243  func (p *ShTokenizer) shAtomDquotBacktSq
         case repl.AdvanceStr("'"):          case repl.AdvanceStr("'"):
                 return &ShAtom{shtWord, repl.Str(), shqDquotBackt, nil}                  return &ShAtom{shtWord, repl.Str(), shqDquotBackt, nil}
         case repl.AdvanceRegexp(`^(?:[\t !"#%()*+,\-./0-9:;<=>?@A-Z\[\]^_a-z{|}~]+|\\[^$]|\\\$\$|\$\$)+`):          case repl.AdvanceRegexp(`^(?:[\t !"#%()*+,\-./0-9:;<=>?@A-Z\[\]^_a-z{|}~]+|\\[^$]|\\\$\$|\$\$)+`):
                 return &ShAtom{shtWord, repl.Group(0), shqDquotBacktSquot, nil}                  return &ShAtom{shtWord, repl.Str(), shqDquotBacktSquot, nil}
         }          }
         return nil          return nil
 }  }
Line 269  loop:
Line 269  loop:
                 switch {                  switch {
                 case repl.AdvanceRegexp(`^[!#%*+,\-./0-9:=?@A-Z\[\]^_a-z{}~]+`):                  case repl.AdvanceRegexp(`^[!#%*+,\-./0-9:=?@A-Z\[\]^_a-z{}~]+`):
                 case dquot && repl.AdvanceRegexp(`^[\t &'();<>|]+`):                  case dquot && repl.AdvanceRegexp(`^[\t &'();<>|]+`):
                 case squot && repl.AdvanceByte('`'):                  case squot && repl.AdvanceStr("`"):
                 case squot && repl.AdvanceRegexp(`^[\t "&();<>\\|]+`):                  case squot && repl.AdvanceRegexp(`^[\t "&();<>\\|]+`):
                 case squot && repl.AdvanceStr("$$"):                  case squot && repl.AdvanceStr("$$"):
                 case squot:                  case squot:
Line 303  func (p *ShTokenizer) shOperator(q ShQuo
Line 303  func (p *ShTokenizer) shOperator(q ShQuo
                 repl.AdvanceStr("&"):                  repl.AdvanceStr("&"):
                 return &ShAtom{shtOperator, repl.Str(), q, nil}                  return &ShAtom{shtOperator, repl.Str(), q, nil}
         case repl.AdvanceRegexp(`^\d*(?:<<-|<<|<&|<>|>>|>&|>\||<|>)`):          case repl.AdvanceRegexp(`^\d*(?:<<-|<<|<&|<>|>>|>&|>\||<|>)`):
                 return &ShAtom{shtOperator, repl.Group(0), q, nil}                  return &ShAtom{shtOperator, repl.Str(), q, nil}
         }          }
         return nil          return nil
 }  }
Line 364  nextAtom:
Line 364  nextAtom:
         }          }
         repl.Reset(mark)          repl.Reset(mark)
   
         G.Assertf(len(atoms) != 0, "ShTokenizer.ShToken")          G.Assertf(len(atoms) > 0, "ShTokenizer.ShToken")
         return NewShToken(repl.Since(initialMark), atoms...)          return NewShToken(repl.Since(initialMark), atoms...)
 }  }
   

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

CVSweb <webmaster@jp.NetBSD.org>