mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			script-fix
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					14a7cb2d1b | ||
| 
						 | 
					54ae7e7b4d | ||
| 
						 | 
					5363e045bb | 
							
								
								
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							@@ -10,6 +10,9 @@
 | 
			
		||||
[submodule "vendor/grammars/Alloy.tmbundle"]
 | 
			
		||||
	path = vendor/grammars/Alloy.tmbundle
 | 
			
		||||
	url = https://github.com/macekond/Alloy.tmbundle
 | 
			
		||||
[submodule "vendor/grammars/Assembly-Syntax-Definition"]
 | 
			
		||||
	path = vendor/grammars/Assembly-Syntax-Definition
 | 
			
		||||
	url = https://github.com/calculuswhiz/Assembly-Syntax-Definition
 | 
			
		||||
[submodule "vendor/grammars/AutoHotkey"]
 | 
			
		||||
	path = vendor/grammars/AutoHotkey
 | 
			
		||||
	url = https://github.com/ahkscript/SublimeAutoHotkey
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,8 @@ vendor/grammars/Agda.tmbundle:
 | 
			
		||||
- source.agda
 | 
			
		||||
vendor/grammars/Alloy.tmbundle:
 | 
			
		||||
- source.alloy
 | 
			
		||||
vendor/grammars/Assembly-Syntax-Definition:
 | 
			
		||||
- source.assembly.unix
 | 
			
		||||
vendor/grammars/AutoHotkey:
 | 
			
		||||
- source.ahk
 | 
			
		||||
vendor/grammars/BrightScript.tmbundle:
 | 
			
		||||
 
 | 
			
		||||
@@ -57,6 +57,7 @@ module Linguist
 | 
			
		||||
      generated_net_designer_file? ||
 | 
			
		||||
      generated_net_specflow_feature_file? ||
 | 
			
		||||
      composer_lock? ||
 | 
			
		||||
      cargo_lock? ||
 | 
			
		||||
      node_modules? ||
 | 
			
		||||
      go_vendor? ||
 | 
			
		||||
      npm_shrinkwrap_or_package_lock? ||
 | 
			
		||||
@@ -378,6 +379,13 @@ module Linguist
 | 
			
		||||
      !!name.match(/.\.zep\.(?:c|h|php)$/)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Internal: Is the blob a generated Rust Cargo lock file?
 | 
			
		||||
    #
 | 
			
		||||
    # Returns true or false.
 | 
			
		||||
    def cargo_lock?
 | 
			
		||||
      !!name.match(/Cargo\.lock/)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Is the blob a VCR Cassette file?
 | 
			
		||||
    #
 | 
			
		||||
    # Returns true or false
 | 
			
		||||
 
 | 
			
		||||
@@ -4594,6 +4594,8 @@ TOML:
 | 
			
		||||
  type: data
 | 
			
		||||
  extensions:
 | 
			
		||||
  - ".toml"
 | 
			
		||||
  filenames:
 | 
			
		||||
  - Cargo.lock
 | 
			
		||||
  tm_scope: source.toml
 | 
			
		||||
  ace_mode: toml
 | 
			
		||||
  codemirror_mode: toml
 | 
			
		||||
@@ -4808,7 +4810,7 @@ Unix Assembly:
 | 
			
		||||
  extensions:
 | 
			
		||||
  - ".s"
 | 
			
		||||
  - ".ms"
 | 
			
		||||
  tm_scope: source.assembly
 | 
			
		||||
  tm_scope: source.assembly.unix
 | 
			
		||||
  ace_mode: assembly_x86
 | 
			
		||||
  language_id: 120
 | 
			
		||||
Uno:
 | 
			
		||||
 
 | 
			
		||||
@@ -3,17 +3,20 @@ module Linguist
 | 
			
		||||
    # Public: Use shebang to detect language of the blob.
 | 
			
		||||
    #
 | 
			
		||||
    # blob               - An object that quacks like a blob.
 | 
			
		||||
    # candidates         - A list of candidate languages.
 | 
			
		||||
    #
 | 
			
		||||
    # Examples
 | 
			
		||||
    #
 | 
			
		||||
    #   Shebang.call(FileBlob.new("path/to/file"))
 | 
			
		||||
    #
 | 
			
		||||
    # Returns an Array with one Language if the blob has a shebang with a valid
 | 
			
		||||
    # interpreter, or empty if there is no shebang.
 | 
			
		||||
    def self.call(blob, _ = nil)
 | 
			
		||||
    # Returns an array of languages from the candidate list for which the
 | 
			
		||||
    # blob's shebang is valid. Returns an empty list if there is no shebang.
 | 
			
		||||
    # If the candidate list is empty, any language is a valid candidate.
 | 
			
		||||
    def self.call(blob, candidates)
 | 
			
		||||
      return [] if blob.symlink?
 | 
			
		||||
 | 
			
		||||
      Language.find_by_interpreter interpreter(blob.data)
 | 
			
		||||
      languages = Language.find_by_interpreter interpreter(blob.data)
 | 
			
		||||
      candidates.any? ? candidates & languages : languages
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Public: Get the interpreter from the shebang
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,21 @@ module Linguist
 | 
			
		||||
  module Strategy
 | 
			
		||||
    # Detects language based on extension
 | 
			
		||||
    class Extension
 | 
			
		||||
      def self.call(blob, _)
 | 
			
		||||
        Language.find_by_extension(blob.name.to_s)
 | 
			
		||||
      # Public: Use the file extension to detect the blob's language.
 | 
			
		||||
      #
 | 
			
		||||
      # blob               - An object that quacks like a blob.
 | 
			
		||||
      # candidates         - A list of candidate languages.
 | 
			
		||||
      #
 | 
			
		||||
      # Examples
 | 
			
		||||
      #
 | 
			
		||||
      #   Extension.call(FileBlob.new("path/to/file"))
 | 
			
		||||
      #
 | 
			
		||||
      # Returns an array of languages associated with a blob's file extension.
 | 
			
		||||
      # Selected languages must be in the candidate list, except if it's empty,
 | 
			
		||||
      # in which case any language is a valid candidate.
 | 
			
		||||
      def self.call(blob, candidates)
 | 
			
		||||
        languages = Language.find_by_extension(blob.name.to_s)
 | 
			
		||||
        candidates.any? ? candidates & languages : languages
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,22 @@ module Linguist
 | 
			
		||||
  module Strategy
 | 
			
		||||
    # Detects language based on filename
 | 
			
		||||
    class Filename
 | 
			
		||||
      def self.call(blob, _)
 | 
			
		||||
      # Public: Use the filename to detect the blob's language.
 | 
			
		||||
      #
 | 
			
		||||
      # blob               - An object that quacks like a blob.
 | 
			
		||||
      # candidates         - A list of candidate languages.
 | 
			
		||||
      #
 | 
			
		||||
      # Examples
 | 
			
		||||
      #
 | 
			
		||||
      #   Filename.call(FileBlob.new("path/to/file"))
 | 
			
		||||
      #
 | 
			
		||||
      # Returns an array of languages with a associated blob's filename.
 | 
			
		||||
      # Selected languages must be in the candidate list, except if it's empty,
 | 
			
		||||
      # in which case any language is a valid candidate.
 | 
			
		||||
      def self.call(blob, candidates)
 | 
			
		||||
        name = blob.name.to_s
 | 
			
		||||
        Language.find_by_filename(name)
 | 
			
		||||
        languages = Language.find_by_filename(name)
 | 
			
		||||
        candidates.any? ? candidates & languages : languages
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										417
									
								
								samples/TOML/filenames/Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										417
									
								
								samples/TOML/filenames/Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,417 @@
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "aho-corasick"
 | 
			
		||||
version = "0.6.4"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ansi_term"
 | 
			
		||||
version = "0.11.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "atty"
 | 
			
		||||
version = "0.2.8"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "bitflags"
 | 
			
		||||
version = "1.0.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "bytecount"
 | 
			
		||||
version = "0.3.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "simd 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "cfg-if"
 | 
			
		||||
version = "0.1.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "clap"
 | 
			
		||||
version = "2.31.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "crossbeam"
 | 
			
		||||
version = "0.3.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "encoding_rs"
 | 
			
		||||
version = "0.7.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "simd 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "fnv"
 | 
			
		||||
version = "1.0.6"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "fuchsia-zircon"
 | 
			
		||||
version = "0.3.3"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "fuchsia-zircon-sys"
 | 
			
		||||
version = "0.3.3"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "glob"
 | 
			
		||||
version = "0.2.11"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "globset"
 | 
			
		||||
version = "0.3.0"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "grep"
 | 
			
		||||
version = "0.1.8"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ignore"
 | 
			
		||||
version = "0.4.1"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "globset 0.3.0",
 | 
			
		||||
 "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "lazy_static"
 | 
			
		||||
version = "1.0.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "libc"
 | 
			
		||||
version = "0.2.40"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "log"
 | 
			
		||||
version = "0.4.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "memchr"
 | 
			
		||||
version = "2.0.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "memmap"
 | 
			
		||||
version = "0.6.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "num_cpus"
 | 
			
		||||
version = "1.8.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "rand"
 | 
			
		||||
version = "0.4.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "redox_syscall"
 | 
			
		||||
version = "0.1.37"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "redox_termios"
 | 
			
		||||
version = "0.1.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "regex"
 | 
			
		||||
version = "0.2.10"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "regex-syntax"
 | 
			
		||||
version = "0.5.3"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "remove_dir_all"
 | 
			
		||||
version = "0.5.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ripgrep"
 | 
			
		||||
version = "0.8.1"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "bytecount 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "encoding_rs 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "globset 0.3.0",
 | 
			
		||||
 "grep 0.1.8",
 | 
			
		||||
 "ignore 0.4.1",
 | 
			
		||||
 "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "termcolor 0.3.6",
 | 
			
		||||
 "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "same-file"
 | 
			
		||||
version = "1.0.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "simd"
 | 
			
		||||
version = "0.2.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "strsim"
 | 
			
		||||
version = "0.7.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "tempdir"
 | 
			
		||||
version = "0.3.7"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "remove_dir_all 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "termcolor"
 | 
			
		||||
version = "0.3.6"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "wincolor 0.1.6",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "termion"
 | 
			
		||||
version = "1.5.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "textwrap"
 | 
			
		||||
version = "0.9.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "thread_local"
 | 
			
		||||
version = "0.3.5"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ucd-util"
 | 
			
		||||
version = "0.1.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "unicode-width"
 | 
			
		||||
version = "0.1.4"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "unreachable"
 | 
			
		||||
version = "1.0.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "utf8-ranges"
 | 
			
		||||
version = "1.0.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "void"
 | 
			
		||||
version = "1.0.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "walkdir"
 | 
			
		||||
version = "2.1.4"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "winapi"
 | 
			
		||||
version = "0.3.4"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
 "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "winapi-i686-pc-windows-gnu"
 | 
			
		||||
version = "0.4.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "winapi-x86_64-pc-windows-gnu"
 | 
			
		||||
version = "0.4.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "wincolor"
 | 
			
		||||
version = "0.1.6"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[metadata]
 | 
			
		||||
"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4"
 | 
			
		||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
 | 
			
		||||
"checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4"
 | 
			
		||||
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
 | 
			
		||||
"checksum bytecount 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "882585cd7ec84e902472df34a5e01891202db3bf62614e1f0afe459c1afcf744"
 | 
			
		||||
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
 | 
			
		||||
"checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
 | 
			
		||||
"checksum crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19"
 | 
			
		||||
"checksum encoding_rs 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98fd0f24d1fb71a4a6b9330c8ca04cbd4e7cc5d846b54ca74ff376bc7c9f798d"
 | 
			
		||||
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
 | 
			
		||||
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
 | 
			
		||||
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
 | 
			
		||||
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
 | 
			
		||||
"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
 | 
			
		||||
"checksum libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)" = "6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b"
 | 
			
		||||
"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"
 | 
			
		||||
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
 | 
			
		||||
"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
 | 
			
		||||
"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"
 | 
			
		||||
"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5"
 | 
			
		||||
"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
 | 
			
		||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
 | 
			
		||||
"checksum regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "aec3f58d903a7d2a9dc2bf0e41a746f4530e0cab6b615494e058f67a3ef947fb"
 | 
			
		||||
"checksum regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b2550876c31dc914696a6c2e01cbce8afba79a93c8ae979d2fe051c0230b3756"
 | 
			
		||||
"checksum remove_dir_all 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dfc5b3ce5d5ea144bb04ebd093a9e14e9765bcfec866aecda9b6dec43b3d1e24"
 | 
			
		||||
"checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637"
 | 
			
		||||
"checksum simd 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3dd0805c7363ab51a829a1511ad24b6ed0349feaa756c4bc2f977f9f496e6673"
 | 
			
		||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
 | 
			
		||||
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
 | 
			
		||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
 | 
			
		||||
"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
 | 
			
		||||
"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"
 | 
			
		||||
"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
 | 
			
		||||
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
 | 
			
		||||
"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
 | 
			
		||||
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
 | 
			
		||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
 | 
			
		||||
"checksum walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "63636bd0eb3d00ccb8b9036381b526efac53caf112b7783b730ab3f8e44da369"
 | 
			
		||||
"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
 | 
			
		||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 | 
			
		||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 | 
			
		||||
@@ -43,32 +43,24 @@ def log(msg)
 | 
			
		||||
  puts msg if $verbose
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
$aborted = false
 | 
			
		||||
 | 
			
		||||
def command(*args)
 | 
			
		||||
  log "$ #{args.join(' ')}"
 | 
			
		||||
  output, status = Open3.capture2e(*args)
 | 
			
		||||
  if !status.success?
 | 
			
		||||
    output = output.each_line { |line| "  > #{line}" }
 | 
			
		||||
    unless $aborted
 | 
			
		||||
      $aborted = true
 | 
			
		||||
      warn "Command failed. Aborting."
 | 
			
		||||
      raise output
 | 
			
		||||
    else
 | 
			
		||||
      warn output
 | 
			
		||||
      exit 1
 | 
			
		||||
    output.each_line do |line|
 | 
			
		||||
      log "  > #{line}"
 | 
			
		||||
    end
 | 
			
		||||
    warn "Command failed. Aborting."
 | 
			
		||||
    exit 1
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
usage = <<~EOH
 | 
			
		||||
Usage:
 | 
			
		||||
usage = """Usage:
 | 
			
		||||
  #{$0} [-v|--verbose] [--replace grammar] url
 | 
			
		||||
 | 
			
		||||
Examples:
 | 
			
		||||
  #{$0} https://github.com/Alhadis/language-roff
 | 
			
		||||
  #{$0} --replace sublime-apl https://github.com/Alhadis/language-apl
 | 
			
		||||
EOH
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
$replace = nil
 | 
			
		||||
$verbose = true
 | 
			
		||||
@@ -89,71 +81,41 @@ $url = ARGV[0]
 | 
			
		||||
# No URL? Print a usage message and bail.
 | 
			
		||||
unless $url
 | 
			
		||||
  warn usage
 | 
			
		||||
  exit 1
 | 
			
		||||
  exit 1;
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
# Flags to track which changes should be reverted on an error
 | 
			
		||||
$gitmodules  = File.read("#{ROOT}/.gitmodules")
 | 
			
		||||
$git_config  = File.read("#{ROOT}/.git/config")
 | 
			
		||||
$vendor_list = File.read("#{ROOT}/vendor/README.md")
 | 
			
		||||
# Exit early if docker isn't installed or running.
 | 
			
		||||
log "Checking docker is installed and running"
 | 
			
		||||
command('docker', 'ps')
 | 
			
		||||
 | 
			
		||||
def restore_configs
 | 
			
		||||
  File.write("#{ROOT}/.gitmodules", $gitmodules)
 | 
			
		||||
  File.write("#{ROOT}/.git/config", $git_config)
 | 
			
		||||
# Ensure the given URL is an HTTPS link
 | 
			
		||||
parts    = parse_url $url
 | 
			
		||||
https    = "https://#{parts[:host]}/#{parts[:user]}/#{parts[:repo]}"
 | 
			
		||||
repo_new = "vendor/grammars/#{parts[:repo]}"
 | 
			
		||||
repo_old = parse_submodule($replace) if $replace
 | 
			
		||||
 | 
			
		||||
Dir.chdir(ROOT)
 | 
			
		||||
 | 
			
		||||
if repo_old
 | 
			
		||||
  log "Deregistering: #{repo_old}"
 | 
			
		||||
  command('git', 'submodule', 'deinit', repo_old)
 | 
			
		||||
  command('git', 'rm', '-rf', repo_old)
 | 
			
		||||
  command('script/grammar-compiler', 'update', '-f')
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
begin
 | 
			
		||||
  # Exit early if Docker isn't installed or running.
 | 
			
		||||
  log "Checking Docker is installed and running"
 | 
			
		||||
  command('docker', 'ps')
 | 
			
		||||
log "Registering new submodule: #{repo_new}"
 | 
			
		||||
command('git', 'submodule', 'add', '-f', https, repo_new)
 | 
			
		||||
command('script/grammar-compiler', 'add', repo_new)
 | 
			
		||||
 | 
			
		||||
  # Ensure the given URL is an HTTPS link
 | 
			
		||||
  parts     = parse_url $url
 | 
			
		||||
  $https    = "https://#{parts[:host]}/#{parts[:user]}/#{parts[:repo]}"
 | 
			
		||||
  $repo_new = "vendor/grammars/#{parts[:repo]}"
 | 
			
		||||
  $repo_old = parse_submodule($replace) if $replace
 | 
			
		||||
 | 
			
		||||
  Dir.chdir(ROOT)
 | 
			
		||||
 | 
			
		||||
  if $repo_old
 | 
			
		||||
    log "Deregistering: #{$repo_old}"
 | 
			
		||||
    command('git', 'submodule', 'deinit', '-f', $repo_old)
 | 
			
		||||
    command('git', 'rm', '-rf', $repo_old)
 | 
			
		||||
    command('script/grammar-compiler', 'update', '-f')
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  log "Registering new submodule: #{$repo_new}"
 | 
			
		||||
  command('git', 'submodule', 'add', '-f', $https, $repo_new)
 | 
			
		||||
  command('script/grammar-compiler', 'add', $repo_new)
 | 
			
		||||
 | 
			
		||||
  log "Confirming license"
 | 
			
		||||
  if $repo_old
 | 
			
		||||
    command('script/licensed')
 | 
			
		||||
  else
 | 
			
		||||
    repo_abs = File.absolute_path($repo_new)
 | 
			
		||||
    command('script/licensed', '--module', repo_abs)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  log "Updating grammar documentation in vendor/README.md"
 | 
			
		||||
  command('bundle', 'exec', 'rake', 'samples')
 | 
			
		||||
  command('script/sort-submodules')
 | 
			
		||||
  command('script/list-grammars')
 | 
			
		||||
rescue => ex
 | 
			
		||||
  log ex
 | 
			
		||||
  if $repo_new
 | 
			
		||||
    `git reset HEAD .gitmodules #{$repo_new}`
 | 
			
		||||
    `git checkout -- vendor/licenses`
 | 
			
		||||
    `rm -rf #{$repo_new}`
 | 
			
		||||
    `rm -rf .git/modules/#{$repo_new}/`
 | 
			
		||||
    restore_configs()
 | 
			
		||||
  end
 | 
			
		||||
  if $repo_old
 | 
			
		||||
    `rm -rf #{$repo_old}`
 | 
			
		||||
    `git submodule add -f "#{$https}", "#{$repo_old}"`
 | 
			
		||||
    restore_configs()
 | 
			
		||||
  end
 | 
			
		||||
  File.write("#{ROOT}/vendor/README.md", $vendor_list)
 | 
			
		||||
  `git reset HEAD vendor/licenses`
 | 
			
		||||
  `git checkout -- vendor/licenses`
 | 
			
		||||
  exit 1
 | 
			
		||||
log "Confirming license"
 | 
			
		||||
if repo_old
 | 
			
		||||
  command('script/licensed')
 | 
			
		||||
else
 | 
			
		||||
  repo_new = File.absolute_path(repo_new)
 | 
			
		||||
  command('script/licensed', '--module', repo_new)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
log "Updating grammar documentation in vendor/README.md"
 | 
			
		||||
command('bundle', 'exec', 'rake', 'samples')
 | 
			
		||||
command('script/sort-submodules')
 | 
			
		||||
command('script/list-grammars')
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										51
									
								
								test/fixtures/Perl/01-methods.pl
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								test/fixtures/Perl/01-methods.pl
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,51 @@
 | 
			
		||||
#!perl
 | 
			
		||||
use Test::More;
 | 
			
		||||
use Test::Exception;
 | 
			
		||||
 | 
			
		||||
use_ok 'Music::ScaleNote';
 | 
			
		||||
 | 
			
		||||
my $msn = Music::ScaleNote->new(
 | 
			
		||||
    scale_note => 'C',
 | 
			
		||||
    scale_name => 'pminor',
 | 
			
		||||
#    verbose    => 1,
 | 
			
		||||
);
 | 
			
		||||
isa_ok $msn, 'Music::ScaleNote';
 | 
			
		||||
 | 
			
		||||
my $x;
 | 
			
		||||
 | 
			
		||||
throws_ok { $x = $msn->get_offset() }
 | 
			
		||||
    qr/note_name, note_format or offset not provided/, 'invalid get_offset';
 | 
			
		||||
 | 
			
		||||
my $format = 'midinum';
 | 
			
		||||
$x = $msn->get_offset(
 | 
			
		||||
    note_name   => 60,
 | 
			
		||||
    note_format => $format,
 | 
			
		||||
    offset      => 1,
 | 
			
		||||
);
 | 
			
		||||
is $x->format($format), 63, 'get_offset';
 | 
			
		||||
 | 
			
		||||
$format = 'ISO';
 | 
			
		||||
$x = $msn->get_offset(
 | 
			
		||||
    note_name   => 'D#4',
 | 
			
		||||
    note_format => $format,
 | 
			
		||||
    offset      => -1,
 | 
			
		||||
);
 | 
			
		||||
is $x->format($format), 'C4', 'get_offset';
 | 
			
		||||
 | 
			
		||||
throws_ok {
 | 
			
		||||
    $x = $msn->get_offset(
 | 
			
		||||
        note_name   => 'C0',
 | 
			
		||||
        note_format => $format,
 | 
			
		||||
        offset      => -1,
 | 
			
		||||
    )
 | 
			
		||||
} qr/Octave: -1 out of bounds/, 'out of bounds';
 | 
			
		||||
 | 
			
		||||
throws_ok {
 | 
			
		||||
    $x = $msn->get_offset(
 | 
			
		||||
        note_name   => 'A#127',
 | 
			
		||||
        note_format => $format,
 | 
			
		||||
        offset      => 1,
 | 
			
		||||
    )
 | 
			
		||||
} qr/Octave: 128 out of bounds/, 'out of bounds';
 | 
			
		||||
 | 
			
		||||
done_testing();
 | 
			
		||||
@@ -169,6 +169,9 @@ class TestBlob < Minitest::Test
 | 
			
		||||
    assert sample_blob_memory("JavaScript/jquery-1.6.1.min.js").generated?
 | 
			
		||||
    assert sample_blob_memory("JavaScript/jquery-1.4.2.min.js").generated?
 | 
			
		||||
 | 
			
		||||
    # Cargo generated composer.lock file
 | 
			
		||||
    assert sample_blob_memory("TOML/filenames/Cargo.lock").generated?
 | 
			
		||||
 | 
			
		||||
    # Composer generated composer.lock file
 | 
			
		||||
    assert sample_blob_memory("JSON/filenames/composer.lock").generated?
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/README.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/README.md
									
									
									
									
										vendored
									
									
								
							@@ -377,7 +377,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
 | 
			
		||||
- **TypeScript:** [Microsoft/TypeScript-TmLanguage](https://github.com/Microsoft/TypeScript-TmLanguage)
 | 
			
		||||
- **Unified Parallel C:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle)
 | 
			
		||||
- **Unity3D Asset:** [atom/language-yaml](https://github.com/atom/language-yaml)
 | 
			
		||||
- **Unix Assembly:** [Nessphoro/sublimeassembly](https://github.com/Nessphoro/sublimeassembly)
 | 
			
		||||
- **Unix Assembly:** [calculuswhiz/Assembly-Syntax-Definition](https://github.com/calculuswhiz/Assembly-Syntax-Definition)
 | 
			
		||||
- **Uno:** [atom/language-csharp](https://github.com/atom/language-csharp)
 | 
			
		||||
- **UnrealScript:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle)
 | 
			
		||||
- **UrWeb:** [gwalborn/UrWeb-Language-Definition](https://github.com/gwalborn/UrWeb-Language-Definition)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/grammars/Assembly-Syntax-Definition
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/Assembly-Syntax-Definition
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/Assembly-Syntax-Definition added at 3d82aa7847
									
								
							
							
								
								
									
										26
									
								
								vendor/licenses/grammar/Assembly-Syntax-Definition.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								vendor/licenses/grammar/Assembly-Syntax-Definition.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
---
 | 
			
		||||
type: grammar
 | 
			
		||||
name: Assembly-Syntax-Definition
 | 
			
		||||
license: mit
 | 
			
		||||
---
 | 
			
		||||
The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2016 calculuswhiz
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
SOFTWARE.
 | 
			
		||||
		Reference in New Issue
	
	Block a user