mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-29 13:21:01 +00:00
Merge pull request #2524 from github/more-encompassing-number-skips
More encompassing number skips
This commit is contained in:
@@ -96,7 +96,7 @@ module Linguist
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Skip number literals
|
# Skip number literals
|
||||||
elsif s.scan(/(0x)?\d(\d|\.)*/)
|
elsif s.scan(/(0x\h(\h|\.)*|\d(\d|\.)*)([uU][lL]{0,2}|([eE][-+]\d*)?[fFlL]*)/)
|
||||||
|
|
||||||
# SGML style brackets
|
# SGML style brackets
|
||||||
elsif token = s.scan(/<[^\s<>][^<>]*>/)
|
elsif token = s.scan(/<[^\s<>][^<>]*>/)
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ class TestTokenizer < Minitest::Test
|
|||||||
assert_equal %w(add \( \)), tokenize('add(123, 456)')
|
assert_equal %w(add \( \)), tokenize('add(123, 456)')
|
||||||
assert_equal %w(|), tokenize('0x01 | 0x10')
|
assert_equal %w(|), tokenize('0x01 | 0x10')
|
||||||
assert_equal %w(*), tokenize('500.42 * 1.0')
|
assert_equal %w(*), tokenize('500.42 * 1.0')
|
||||||
|
assert_equal %w(), tokenize('1.23e-04')
|
||||||
|
assert_equal %w(), tokenize('1.0f')
|
||||||
|
assert_equal %w(), tokenize('1234ULL')
|
||||||
|
assert_equal %w(G1 X55 Y5 F2000), tokenize('G1 X55 Y5 F2000')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_skip_comments
|
def test_skip_comments
|
||||||
|
|||||||
Reference in New Issue
Block a user