atom / language-sql

SQL package for Atom
Other
38 stars 50 forks source link

`NOT REGEXP` and `NOT RLIKE` #23

Closed Cxarli closed 9 years ago

Cxarli commented 9 years ago

I thought NOT was a keyword on its own, but it isn't, so I added NOT REGEXP and NOT RLIKE as keywords on their own

Cxarli commented 9 years ago

@50Wliu I'm sorry, there was a misunderstanding with the NOT, fixed here

winstliu commented 9 years ago

Do any of the other keywords have not? Would it be worth it to tokenize not as something separate?

Cxarli commented 9 years ago

According to this site, NOT is a keyword which can be used in a lot of places, so should I add it as a regular keyword?

Cxarli commented 9 years ago

Also, while I'm working on this file. W3Schools says that DECIMAL, FLOAT and a few other numbers with decimals exist. Should I use \\d+(\.\\d+)? for number recognition ?

winstliu commented 9 years ago

Yeah, adding not as its own keyword would probably be a good idea (maybe keyword.other.not.sql? /cc @MaximSokolov).

If you're going to change number recognition, please do that in a different PR.

MaximSokolov commented 9 years ago

It's bad that language-sql doesn't have specs yet. It's hard to see what this PR changes. Could you give an example where not is keyword.other.not.sql now? Or add tests to this (see javascript-spec.coffee for example)

SELECT *
FROM suppliers
-- e.g. `NOT` here is still part of `keyword.other.data-integrity`. Should be?
WHERE supplier_name NOT IN ( 'IBM', 'Hewlett Packard', 'Microsoft' );
Cxarli commented 9 years ago

@MaximSokolov For example: SELECT * FROM Users WHERE id IS NOT 3 and SELECT * FROM Users WHERE id NOT REGEXP 'a**d'

MaximSokolov commented 9 years ago

Could you give an example where not is keyword.other.not.sql now?

For example:

SELECT * FROM Users WHERE id IS NOT 3
SELECT * FROM Users WHERE id NOT REGEXP 'a**d'

Works well :+1:

@50Wliu:

adding not as its own keyword would probably be a good idea (maybe keyword.other.not.sql?

keyword.other.not looks good to me. I suppose keyword.other.DML means data manipulation language. I am not quite sure that NOT isn't part of DML sub-scope.

winstliu commented 9 years ago

Now that we're adding specs, it would be great if you could add some for this change as well :).

Cxarli commented 9 years ago

Looks like the specs work

winstliu commented 9 years ago

:+1: