Sublime Text / code parse error for no reason, hidden characters

Asked
Active3 hr before
Viewed126 times

7 Answers

90%

you are unknowingly pasting hidden characters which cause this parse error – Lucky Soni Mar 6 '14 at 10:06 , Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers , Are those row numbers present? May be some unicode "invisible" characters (in odd editor) ? – Alma Do Mar 6 '14 at 10:07 ,I'm currently using Sublime Text (but have had the same types of mistaken parse errors in Notepad++ and the old Homesite editor as well), running MAMP on OS X, but it has happened on my Windows desktop machine as well.

To fix it in Sublime Text you need to edit Preferences/Key bindings - User and add the line:

{
   "keys": ["alt+space"],
   "command": "insert_snippet",
   "args": {
      "contents": " "
   }
},
load more v
88%

I have had this problem for years, but not as frequently as today. This prompted me to ask this question once and for all.,Instead of lengthy math formulas or logic chains, use temporary variables to simplify the code. (More readable = fewer errors.),Invisible stray Unicode characters: In some cases, you need to use a hexeditor or different editor/viewer on your source. Some problems cannot be found just from looking at your code.,Which is occasionally an issue for MacOS users (even on OS  X for misconfigured editors).

Today, I have meticulously typed down every character exactly as the line failing and then removing the old one, just to have the script working. For example:

1 foreach($_POST['data_positions'] AS $k => $v) {
   2
   3
}

threw a parse error on line 1. I bumped the code down to row 2 and wrote the exact same line 1 again (I check several times that every character is the same), then removing line 2, and it works. Another example:

1
if (is_numeric($k)) {
   2
   3
}
load more v
72%

Ah I see ur a man of culture
load more v
65%

You can install any package control in Sublime Text editor using the shortcut key combination Ctrl+Shift+P, and selecting the Package Control: Install Package option.,To open a command palette in Sublime Text editor, you can use the shortcut key combination Ctrl+Shift+P on Windows and Cmd+Shift+P on OSX.,Throughout this tutorial, we will be focusing on using the subversion control system, Git and bit bucket in combination with Sublime Text editor.,There are various types of code editing and shortcut keys used in Sublime Text editor −

Step 1 − Using the command line terminal, install the packages for Sublime Text editor, using the command given below −

sudo add - apt - repository ppa: webupd8team / Sublime - Text - 3
load more v
75%

Sublime Text colors your code according to the syntax you use,And Sublime Text 3 on your computer.,Editing your first script with Sublime Text3 on your remote server.,Installing Package Control to Sublime Text 3. (On your local computer.)

Once you are logged in to your server, run these 3 commands one by one:

sudo curl - o / usr / local / bin / rmate https: //raw.githubusercontent.com/aurora/rmate/master/rmate
   sudo chmod + x / usr / local / bin / rmate
sudo mv / usr / local / bin / rmate / usr / local / bin / sublime
load more v
40%

I'll let you in a secret: you don't have to compile your code all the time to see the errors. The plugin comes with an excellent error window that displays errors in real time.,The plugin provides 2 very important pieces of functionality:,Getting started with TypeScript and Sublime Text couldn't be easier. I hope you found this post useful and, as always, feel free to leave your comments or questions below.,There are a few steps required in order to get up and running with TypeScript in Sublime Text so we will take it from the top, assuming you have nothing installed.

  • Package Control --> Install Package --> TypeScript
  • Clone the repo directly into your Sublime plugin folder:
cd "%APPDATA%\Sublime Text 3\Packages"
git clone--depth 1 https: //github.com/Microsoft/TypeScript-Sublime-Plugin.git TypeScript`
load more v
22%

Sublime Text is, no doubt, one of the most powerful text editors out there. The number of satisfied users attests to that. If you explore it, you will eventually see how beautifully its powerful features are hidden behind a simple and elegant interface.,This is probably the most powerful and most-used command in Sublime Text. Navigate through files, folders, symbols and lines with ease.,For writers and others who need to be able to concentrate intently, Sublime Text has an even more minimalistic interface. Use the shortcut to toggle distraction-free mode on and off.,Sublime Text comes with an embedded Python interpreter. It’s a handy tool to execute Python commands or to quickly test Sublime Text’s APIs when you’re developing a plugin for the editor.

Assuming you’ve placed Sublime Text in the “Applications” folder and that you have a ~/bin directory in your path, you can run the following:

ln - s "/Applications/Sublime
Text.app / Contents / SharedSupport / bin / subl " ~/bin/sublime
load more v

Other "undefined-undefined" queries related to "Sublime Text / code parse error for no reason, hidden characters"